How to turn a matrix into a Multidimensional Array?

5 views (last 30 days)
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

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 28 Oct 2013
Edited: Andrei Bobrov on 28 Oct 2013
permute(A,[3 2 1])
or
reshape(A.',1,size(A,2),[])

More Answers (0)

Categories

Find more on Matrices and Arrays 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!