Can I create an array of matricies?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
James
am 23 Okt. 2013
Kommentiert: sixwwwwww
am 28 Okt. 2013
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 Kommentare
Akzeptierte Antwort
sixwwwwww
am 23 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!