1
votes

A is a multidimensional vector 3x3x3. I want to change it to be 9x3 vector. How can I do this in matlab?

2
I can understand the closevotes, but why downvoting? The question is clear, and finding the solution is not trivial without knowing the right keywords. - Dennis Jaheruddin

2 Answers

2
votes

You can do it using the reshape function.

B = reshape(A,9,3);

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

or

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

The previous will arrange the 2D vectors along rows, while the later will arrange them allong colums