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:
Rotating a matrix

Subject: Rotating a matrix

From: Raghavasimhan Thirunarayanan

Date: 25 Feb, 2009 09:31:01

Message: 1 of 3

Hello,
I want to know whether in matlab, a matrix that is got from the user can be rotated....
For example if my input matrix is
1 2 3 0
4 5 6 0
7 8 9 0....
my desired matrix is
1 2 3 0 4 5 6 0 7 8 9 0
4 5 6 0 7 8 9 0 1 2 3 0
7 8 9 0 1 2 3 0 4 5 6 0
In other words if my input matrix is
A
B
C
D...
I want a new matrix constructed looking like this,
A B C D
B C D A
C D A B
D A B C

I want this done for matrices of any order....
Is it possible...If so kindly help me out in this...
Thanks in advance
                                 

Subject: Rotating a matrix

From: Bruno Luong

Date: 25 Feb, 2009 09:37:02

Message: 2 of 3

"Raghavasimhan Thirunarayanan" <kingmakerbull@rediffmail.com> wrote in message <go334l$8fh$1@fred.mathworks.com>...

> In other words if my input matrix is
> A
> B
> C
> D...
> I want a new matrix constructed looking like this,
> A B C D
> B C D A
> C D A B
> D A B C
>
> I want this done for matrices of any order....
> Is it possible...If so kindly help me out in this...
> Thanks in advance

Help hankel

Bruno
>

Subject: Rotating a matrix

From: Jos

Date: 25 Feb, 2009 12:51:01

Message: 3 of 3

"Raghavasimhan Thirunarayanan" <kingmakerbull@rediffmail.com> wrote in message <go334l$8fh$1@fred.mathworks.com>...
> Hello,
> I want to know whether in matlab, a matrix that is got from the user can be rotated....
> For example if my input matrix is
> 1 2 3 0
> 4 5 6 0
> 7 8 9 0....
> my desired matrix is
> 1 2 3 0 4 5 6 0 7 8 9 0
> 4 5 6 0 7 8 9 0 1 2 3 0
> 7 8 9 0 1 2 3 0 4 5 6 0
> In other words if my input matrix is
> A
> B
> C
> D...
> I want a new matrix constructed looking like this,
> A B C D
> B C D A
> C D A B
> D A B C
>
> I want this done for matrices of any order....
> Is it possible...If so kindly help me out in this...
> Thanks in advance
>

I do not understand what you want at all. In your first example you ask for a rotation of an input matrix, but then the desired matrix has three times the number of columns of your input matrix? And even if I try to understand this, why don't you rotate the column of zeros?

I think that "in other words" should read: "Here is a second, unrelated question" ... and what do you mean by "matrices of any order".

Rephrase your problem giving better examples! Or "in other words", type "why" at the command prompt, or use Bruno's solution "hankel" ;-)

Jos

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