From: apit on
i have the question about the example of the coding to flip the matrix A = 1 2 3 4 5
1 2 4 5 6
3 4 5 6 7
4 3 2 1 4
3 4 2 4 5

to be matrix A = 5 4 3 2 1
6 5 4 2 1
7 6 5 4 3
4 1 2 3 4
5 4 2 4 3
From: Sadik on
Hi Apit,

fliplr(A)

Best.
From: apit on

can u give one example for flip column 1 and column 3?...

"Sadik " <sadik.hava(a)gmail.com> wrote in message <hov6ba$c06$1(a)fred.mathworks.com>...
> Hi Apit,
>
> fliplr(A)
>
> Best.
From: Sadik on
Sure.

columnIndices = 1:size(A,3);

columnIndices(3) = 1;
columnIndices(1) = 3;

% so that columnIndices = [3 2 1 4 5 6 7 ...

newA = A(:,columnIndices);

Best.
From: Sadik on
I am making lots of typos today, sorry. :)

columnIndices = 1:size(A,3);

should have been

columnIndices = 1:size(A,2);

Best.
 | 
Pages: 1
Prev: Image segmentation
Next: working with map