MATLAB question


I am trying to convert a 3D matrix which has one dimension of one into a 2D thus:-


1 3 3

and I need to convert it into a 3x3 matrix.

What is the command for doing this?

Who is Participating?
wood14Connect With a Mentor Commented:
The best way of doing it is


See the mathworks web site
lbertaccoConnect With a Mentor Commented:
b=reshape(a, 3, 3)

then  size(b) gives:
     3     3
DanJWAuthor Commented:
Sorry about that.

They both work but with squeeze you dont need to know the dimensionality beforehand and so that is the accepted answer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.