help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: appending matrix into a matrix


From: Thorsten Meyer
Subject: Re: appending matrix into a matrix
Date: Wed, 13 May 2009 21:57:15 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

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 <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]