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:
Creating a vector of matrices?

Subject: Creating a vector of matrices?

From: SG

Date: 17 Nov, 2010 17:38:05

Message: 1 of 2

Hi there,

I would like to be able to create a vector or an array of matrices - is that possible?

For example, if I have three matrices:

M1 = [1:5;1:5];
M2 = [2:6;2:6];
M3 = [6:10;6:10];

and I would like to be able to have them as elements of a vector (VM) so that I can call them up by using VM(i) (and if the i were a 1 it would call up M1), or VM(:,:,i) if that is the more accurate approach. I am not sure how to go about this, but I would like to be able to put them in a for loop and be able to have each of the M matrices go through a set of if statements.

If more clarification is needed, I am happy to provide it!

 

Subject: Creating a vector of matrices?

From: Sean de

Date: 17 Nov, 2010 18:13:05

Message: 2 of 2

"SG " <sigrdson@gmail.com> wrote in message <ic13ts$stb$1@fred.mathworks.com>...
> Hi there,
>
> I would like to be able to create a vector or an array of matrices - is that possible?
>
> For example, if I have three matrices:
>
> M1 = [1:5;1:5];
> M2 = [2:6;2:6];
> M3 = [6:10;6:10];
>
> and I would like to be able to have them as elements of a vector (VM) so that I can call them up by using VM(i) (and if the i were a 1 it would call up M1), or VM(:,:,i) if that is the more accurate approach. I am not sure how to go about this, but I would like to be able to put them in a for loop and be able to have each of the M matrices go through a set of if statements.
>
> If more clarification is needed, I am happy to provide it!
>
>

Well you'll need cells. This is exactly what they do!

doc cell

Tags for 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