Solved

MATLAB question

Posted on 2004-04-23
4
228 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Introduction to Processes
Starting up a Project

729 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