I need a loop which puts every (j,k) element of every matrix in different columns.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sain Cloud
am 10 Apr. 2019
Kommentiert: Sain Cloud
am 10 Apr. 2019
a = [1 2 ;3 4]; % This are my matrices
b = [5 6 ;7 8]
% I need a loop which puts every (j,k) element-
% of every matrix in different columns. It means i have 4 colums-
% and each have 2 rows . Finaly it should look
% like this:
[1;5] ,[3;7], [2;6], [4;8]
PS. : It has to be an loop.
Thanks very much!
3 Kommentare
Akzeptierte Antwort
Jan
am 10 Apr. 2019
What about:
d = cat(3, O{:});
d = permute(d, [3,1,2])
Now you have the wanted columns as first index.
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!