Section: Array Generation and Manipulations
y = fliplr(x)
where x
is matrix. If x
is an N-dimensional array then
the second dimension is reversed.
fliplr
applied to a 2D matrix.
--> x = int32(rand(4)*10) x = <int32> - size: [4 4] Columns 1 to 4 2 7 9 5 6 6 1 2 1 0 9 6 9 9 3 9 --> fliplr(x) ans = <int32> - size: [4 4] Columns 1 to 4 5 9 7 2 2 1 6 6 6 9 0 1 9 3 9 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 2 2 1 2 5 7 9 9 5 1 4 1 3 4 3 3 (:,:,2) = Columns 1 to 4 5 5 8 8 7 5 3 0 7 9 4 7 5 4 9 4 (:,:,3) = Columns 1 to 4 6 4 7 3 7 5 4 0 4 8 7 8 0 9 8 9 --> fliplr(x) ans = <int32> - size: [4 4 3] (:,:,1) = Columns 1 to 4 2 1 2 2 9 9 7 5 1 4 1 5 3 3 4 3 (:,:,2) = Columns 1 to 4 8 8 5 5 0 3 5 7 7 4 9 7 4 9 4 5 (:,:,3) = Columns 1 to 4 3 7 4 6 0 4 5 7 8 7 8 4 9 8 9 0