A is a multidimensional vector 3x3x3. I want to change it to be 9x3 vector. How can I do this in matlab?
Asked
Active
Viewed 301 times
-5
-
4possible 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
-
1I 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 Answers
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

user2613077
- 78
- 4