How to turn a matrix into a Multidimensional Array?

for example if I have:
>> A=[2 8; 0 5]
A =
2 8
0 5
and I want to separate each row so that A=
A(:,:,1) =
2 8
A(:,:,2) =
0 5

 Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 28 Okt. 2013
Bearbeitet: Andrei Bobrov am 28 Okt. 2013
permute(A,[3 2 1])
or
reshape(A.',1,size(A,2),[])

Weitere Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by