Solved

MATLAB question

Posted on 2004-04-23
4
222 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
4 Comments
 
LVL 11

Assisted Solution

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

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

Accepted Solution

by:
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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

785 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