appending matrix into a matrix
Thorsten Meyer
thorsten.meyier at gmx.de
Wed May 13 14:57:15 CDT 2009
James Sherman Jr. wrote:
> If you want to do it by adding rows, I think you're looking for something
> like
> T = [];
>
> for i = 1:length(C)
> T = [T;C{i}];
> end
>
> If you want to do it by adding columns, just change the ; to a ,
>
> Hope this helps.
>
>
> On Wed, May 13, 2009 at 1:05 PM, Carlo Rossi <serosole at yahoo.it> wrote:
>
>> Hello,
>> I need to appending a matrix to a matrix like here:
>>
>> for i=1 : 10
>> T = CELL{i};
>> end
>>
>> but in this way T is overwritten. How can I do? thanks,
>>
How about:
# generate a test case
for n = 1:10
C{n} = rand(10,10);
endfor
# concatenate vertically
vertcat(C{:})
# concatenate horizonatlly
[C{:}]
regards
Thorsten
More information about the Help-octave
mailing list