Help with Reshaping Multidimensional Arrays

I have Multidimensional Arrays, but I need of a reshaped matrix, indexing columns of each "dimension".
The number of arrays and number of rows can change according to the user, like that:
A (1:x, 1:3, 1:y) if x= 3 and y = 2
A(:,:,1)= [1 2 3
4 5 6
7 8 9];
A(:,:,2)= [10 11 12
13 13 15
16 17 18];
Matlab answer
B = Reshape (A,x*y,3)
B= [1 3 11
4 6 13
7 9 17
2 10 12
5 13 15
8 16 18];
I need the answer:
B= [1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
16 17 18];
Thank for your help

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

产品

版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by