Reputation:
IMAGE1
IMAGE2
DESIRED IMAGE
I am using function flipud
and rot90
to rotate IMAGE1 to look like IMAGE2 as following:
IMAGE2=rot90(flipud(IMAGE1));
However, somehow I do not get the desired result which is DESIRED IMAGE. Could anyone identify why? Please ignore the side legend cutout in DESIRED IMAGE.
Upvotes: 0
Views: 1004
Reputation: 74940
Here's an example for a 2D array (see comments)
%# create a 2D array (3x3, but it'll work for 50x50 as well)
m = magic(3)
m =
8 1 6
3 5 7
4 9 2
%# flip, then rotate, but rotate clockwise, hence the -1
rot90(flipud(m),-1)
ans =
8 3 4
1 5 9
6 7 2
%# Note that this is the same as taking the transpose
m'
ans =
8 3 4
1 5 9
6 7 2
Upvotes: 1