Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how to combine many matrices

Subject: how to combine many matrices

From: Pooky

Date: 26 Apr, 2009 08:01:01

Message: 1 of 3

Hi,

I have 1000 matrices, A1,A2,......, A1000
each matrix has 5x8 dimension

I want to create matrix X = [A1 ; A2 ; ....... ; A1000] which has 5000x8 dimesion
(add A2 as rows after A1 and so on)

Do you know the Matlab code to create matrix X, without typing A1 ; A2 ; .....to A1000 ??

thanks

Subject: how to combine many matrices

From: Gustavo Morales

Date: 26 Apr, 2009 08:19:02

Message: 2 of 3

Pooky:

Maybe like this:
N = 1000;
A = [];
for i = 1:N
   eval(['A = cat(1,A,A',int2str(i),');']);
end

%Gustavo

Subject: how to combine many matrices

From: Jos

Date: 26 Apr, 2009 11:42:03

Message: 3 of 3

"Pooky " <pooky100@hotmail.com> wrote in message <gt14bs$o7a$1@fred.mathworks.com>...
> Hi,
>
> I have 1000 matrices, A1,A2,......, A1000
> each matrix has 5x8 dimension
>
> I want to create matrix X = [A1 ; A2 ; ....... ; A1000] which has 5000x8 dimesion
> (add A2 as rows after A1 and so on)
>
> Do you know the Matlab code to create matrix X, without typing A1 ; A2 ; .....to A1000 ??
>
> thanks

How did you get these matrices. Assuming that they did not suddenly appeared in your workspace, I suggest you use another way to load them, in order to avoid the mess you find your self in right now ...

hth
Jos

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us