Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
reshaping issue

Subject: reshaping issue

From: Aidy

Date: 11 Dec, 2010 17:57:04

Message: 1 of 3

Hi guys,

I have a matrix A:

A =
             10
             30
             50
             70
             90
             20

How can I reshape it as follows:

result =
                      10 30
                      50 70
                      90 20

any help welcome.

cheers
aiden

Subject: reshaping issue

From: Walter Roberson

Date: 11 Dec, 2010 18:03:21

Message: 2 of 3

On 11/12/10 11:57 AM, Aidy wrote:
> Hi guys,
>
> I have a matrix A:
>
> A = 10 30
> 50
> 70
> 90
> 20
>
> How can I reshape it as follows:
>
> result = 10 30
> 50 70
> 90 20

reshape(A,2,3).'

Notice that although you wanted 3 x 2, you have to reshape to 2 x 3 and
then transpose the result. This kind of technique is needed when you
want a vector of values to be distributed _across_ rows.

Subject: reshaping issue

From: Aidy

Date: 11 Dec, 2010 18:22:04

Message: 3 of 3

Walter,

many thanks

,aiden

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us