-5

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

Tak
  • 3,536
  • 11
  • 51
  • 93
  • 4
    possible duplicate of [Reshaping a matrix in matlab](http://stackoverflow.com/questions/15102216/reshaping-a-matrix-in-matlab), [How do I resize a matrix in MATLAB?](http://stackoverflow.com/questions/793574/how-do-i-resize-a-matrix-in-matlab), [Reshape 3d matrix to 2d matrix](http://stackoverflow.com/questions/2256925/reshape-3d-matrix-to-2d-matrix) and many more... – Eitan T Jul 24 '13 at 15:47
  • 1
    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 Jul 25 '13 at 08:47

2 Answers2

2

You can do it using the reshape function.

B = reshape(A,9,3);

Dan455
  • 352
  • 1
  • 9
1
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