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:
reformat matrix

Subject: reformat matrix

From: joey hart

Date: 30 Sep, 2010 16:37:07

Message: 1 of 2

hi guys,

need some help please.

I have a matrix:

[ 1 2 3 4 1 2 3 4 1 2 3 4;
  5 6 7 8 5 6 7 8 5 6 7 8]

How can I reform it to be in the form:

[ 1 2 3 4;
  1 2 3 4;
  1 2 3 4;
  5 6 7 8 ;
  5 6 7 8 ;
  5 6 7 8 ]

joey

Subject: reformat matrix

From: Roger Stafford

Date: 30 Sep, 2010 17:10:26

Message: 2 of 2

"joey hart" <joeyz0123@gmail.com> wrote in message <i82ebj$ob1$1@fred.mathworks.com>...
> hi guys,
>
> need some help please.
>
> I have a matrix:
>
> [ 1 2 3 4 1 2 3 4 1 2 3 4;
> 5 6 7 8 5 6 7 8 5 6 7 8]
>
> How can I reform it to be in the form:
>
> [ 1 2 3 4;
> 1 2 3 4;
> 1 2 3 4;
> 5 6 7 8 ;
> 5 6 7 8 ;
> 5 6 7 8 ]
>
> joey
- - - - - - - -
 M2 = reshape(M1.',4,[]).';

Roger Stafford

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