Change multidimensional vector to two-dimensional vector matlab

A - multidimensional vector 3x3x3. I want to change it as a 9x3 vector. How to do it in matlab?

-5
source share
2 answers

You can do this using the reshape function .

B = reshape(A,9,3);

+2
source
vector2D = cat(2,vector3D(:,:,1),vector3D(:,:,2),vector3D(:,:,3))

or

vector2D = cat(1,vector3D(:,:,1),vector3D(:,:,2),vector3D(:,:,3))

The previous ones arrange 2D vectors along the lines, and later arrange them allong colums

+1
source

All Articles