?
Solved

MATLAB question

Posted on 2004-04-23
4
Medium Priority
?
232 Views
Last Modified: 2010-04-17
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
Comment
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
  • Learn & ask questions
4 Comments
 
LVL 11

Assisted Solution

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

then  size(b) gives:
     3     3
0
 
LVL 1

Accepted Solution

by:
wood14 earned 1200 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

by:DanJW
ID: 11097690
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Simple Linear Regression
Six Sigma Control Plans

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question