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 8 0 5 0 5 0 0 6 7 5 9 4 6 3 7 0 --> fliplr(x) ans = <int32> - size: [4 4] Columns 1 to 4 0 5 0 8 6 0 0 5 4 9 5 7 0 7 3 6
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 1 6 6 7 8 3 3 3 8 0 9 3 0 9 3 0 (:,:,2) = Columns 1 to 4 8 2 5 5 9 7 3 9 1 6 3 2 3 6 7 4 (:,:,3) = Columns 1 to 4 6 6 6 8 3 4 6 4 9 7 8 5 8 5 5 4 --> fliplr(x) ans = <int32> - size: [4 4 3] (:,:,1) = Columns 1 to 4 7 6 6 1 3 3 3 8 3 9 0 8 0 3 9 0 (:,:,2) = Columns 1 to 4 5 5 2 8 9 3 7 9 2 3 6 1 4 7 6 3 (:,:,3) = Columns 1 to 4 8 6 6 6 4 6 4 3 5 8 7 9 4 5 5 8