Solved

# MATLAB question

Posted on 2004-04-23
227 Views
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
Question by:DanJW
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 11

Assisted Solution

lbertacco earned 200 total points
ID: 10901237
b=reshape(a, 3, 3)

then  size(b) gives:
3     3
0

LVL 1

Accepted Solution

wood14 earned 300 total points
ID: 10911385
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

Author Comment

ID: 11097690

They both work but with squeeze you dont need to know the dimensionality beforehand and so that is the accepted answer
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

### Suggested Solutions

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression
###### Suggested Courses
Course of the Month6 days, 12 hours left to enroll