• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

MATLAB question

Hi,

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

size(A)=

1 3 3

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

What is the command for doing this?


0
DanJW
Asked:
DanJW
2 Solutions
 
lbertaccoCommented:
b=reshape(a, 3, 3)

then  size(b) gives:
     3     3
0
 
wood14Commented:
The best way of doing it is

B=squeeze(A)

See the mathworks web site

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/squeeze.html
0
 
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
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now