From: antonio ferreira on 20 Jul 2010 09:47 Hi all. I have a matrix A=[1;1;1;1;1;1;1] and a matrix B=[1;2;3]. I want to create a matrix C=[1;2;3;1;1;1;1]. Perhaps this is not very difficult but I am not being able to solve this. Any suggestions would be helpful.Regards
From: Andy on 20 Jul 2010 09:54 "antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i249cp$1rt$1(a)fred.mathworks.com>... > Hi all. I have a matrix A=[1;1;1;1;1;1;1] and a matrix B=[1;2;3]. I want to create a matrix C=[1;2;3;1;1;1;1]. Perhaps this is not very difficult but I am not being able to solve this. Any suggestions would be helpful.Regards Are you trying to concatenate A and B, or are you replacing the first elements of A with B? To get the C you have given, you could do: C=A; %make a copy C(1:3) = B; % replace first elements with B To concatenate A and B (with B coming first), as your title suggests you want: C=[B;A];
From: antonio ferreira on 20 Jul 2010 09:54 "antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i249cp$1rt$1(a)fred.mathworks.com>... > Hi all. I have a matrix A=[1;1;1;1;1;1;1] and a matrix B=[1;2;3]. I want to create a matrix C=[1;2;3;1;1;1;1]. Perhaps this is not very difficult but I am not being able to solve this. Any suggestions would be helpful.Regards Sorry, I have already managed to solve my problem. One of the possible solution is: C=[B;A((length(B)+1):end)].Regards
From: someone on 20 Jul 2010 09:59 "antonio ferreira" <edgar.acferreira(a)gmail.com> wrote in message <i249cp$1rt$1(a)fred.mathworks.com>... > Hi all. I have a matrix A=[1;1;1;1;1;1;1] and a matrix B=[1;2;3]. I want to create a matrix C=[1;2;3;1;1;1;1]. Perhaps this is not very difficult but I am not being able to solve this. Any suggestions would be helpful.Regards % One solution: A = ones(7,1); B = (1:3)'; C = [B;A(4:end)];
|
Pages: 1 Prev: remove row if it is 'mirrored' Next: remove row if it is 'mirrored' |