Any Matlab developers here?

Rupp

Senior Member
Any Matlab users in the house? I have to convert this line to vb.net but I'm not sure what this call is doing.
y2=-rot90(rot90(y1))
I know that rot90(y1) is rotating the y1 array 90 degrees counter clockwise. What I do not understand is what the - rot90() does. It seems to me it's rotating the array back. Any help would be appreciated.
 
Any Matlab users in the house? I have to convert this line to vb.net but I'm not sure what this call is doing.
y2=-rot90(rot90(y1))
I know that rot90(y1) is rotating the y1 array 90 degrees counter clockwise. What I do not understand is what the - rot90() does. It seems to me it's rotating the array back. Any help would be appreciated.

It is not rotating the data like a transformation matrix per se, it is actually rotating the numbers in the matrix. So the code does this:


a =
1 2
3 4

rot90(a) =
2 4
1 3

rot90(rot90(a)) =
4 3
2 1

-rot90(rot90(a)) =
-4 -3
-2 -1


I don't have matlab at home to test it but this I'm pretty sure my example is correct.

Here is the help file

http://www.mathworks.com/access/helpdesk/h...lient=firefox-a

Rotate matrix 90 degrees
Syntax

B = rot90(A)
B = rot90(A,k)
Description

B = rot90(A) rotates matrix A counterclockwise by 90 degrees.

B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer.
Examples

The matrix

X =
1 2 3
4 5 6
7 8 9

rotated by 90 degrees is

Y = rot90(X)
Y =
3 6 9
2 5 8
1 4 7
 
Back
Top