Can I create an array of matricies?
1 view (last 30 days)
Show older comments
Hi, I'd like to know if I could create some matricies from array elements, for example, if I have four arrays of dimension n by 1, can I then create n matricies by defining something like M(i)=[array1(i),array2(i);array3(i),array4(i)] and running a loop over i? Any help would be appreciated. Thanks. Edit: Thanks for answering sixwwwwww, I didn't know you could make a matrix of arrays, but I was kind of hoping to do it the other way round (an array of matricies). My goal is to put the matricies into an equation and then plot the resulting elements, so I was hoping to be able to do something like: define a set of n matricies using nth elements of my arrays, put these n matrices into my equation to obtain another set of n matrices, then plot the resulting matrix elements against some function of n. Is there any way I could do this?
0 Comments
Accepted Answer
sixwwwwww
on 23 Oct 2013
Dear James. you dont need loop for this you can do it like this:
array1 = rand(10, 1);
array2 = rand(10, 1) * 2;
array3 = rand(10, 1) * 3;
array4 = rand(10, 1) * 4;
M = [array1 array2 array3 array4];
I hope it is what you need. Good luck!
3 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!