MATLAB question

Posted on 2004-04-23
Last Modified: 2010-04-17

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?

Question by:DanJW
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
LVL 11

Assisted Solution

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

then  size(b) gives:
     3     3

Accepted Solution

wood14 earned 300 total points
ID: 10911385
The best way of doing it is


See the mathworks web site

Author Comment

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

Featured Post

Independent Software Vendors: 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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

740 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