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