Reverses the columns of a matrix. The syntax for its use is
y = fliplr(x)
where x is matrix. If x is an N-dimensional array then
the second dimension is reversed.
The following example shows fliplr applied to a 2D matrix.
--> x = int32(rand(4)*10)
x =
<int32> - size: [4 4]
Columns 1 to 4
8 6 9 9
9 0 9 4
1 2 1 8
9 5 9 1
--> fliplr(x)
ans =
<int32> - size: [4 4]
Columns 1 to 4
9 9 6 8
4 9 0 9
8 1 2 1
1 9 5 9
For a 3D array, note how the columns in each slice are flipped.
--> x = int32(rand(4,4,3)*10)
x =
<int32> - size: [4 4 3]
(:,:,1) =
Columns 1 to 4
8 6 9 9
9 0 9 4
1 2 1 8
9 5 9 1
(:,:,2) =
Columns 1 to 4
4 6 6 6
9 0 7 1
7 8 7 7
9 9 3 0
(:,:,3) =
Columns 1 to 4
2 6 4 1
0 3 3 4
0 9 7 4
8 0 7 6
--> fliplr(x)
ans =
<int32> - size: [4 4 3]
(:,:,1) =
Columns 1 to 4
9 9 6 8
4 9 0 9
8 1 2 1
1 9 5 9
(:,:,2) =
Columns 1 to 4
6 6 6 4
1 7 0 9
7 7 8 7
0 3 9 9
(:,:,3) =
Columns 1 to 4
1 4 6 2
4 3 3 0
4 7 9 0
6 7 0 8