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 = 8 0 5 0 5 0 0 6 7 5 9 4 6 3 7 0 --> fliplr(x) ans = 0 5 0 8 6 0 0 5 4 9 5 7 0 7 3 6 --> quit
For a 3D array, note how the columns in each slice are flipped.
--> x = int32(rand(4,4,3)*10) x = (:,:,1) = 1 6 6 7 8 3 3 3 8 0 9 3 0 9 3 0 (:,:,2) = 8 2 5 5 9 7 3 9 1 6 3 2 3 6 7 4 (:,:,3) = 6 6 6 8 3 4 6 4 9 7 8 5 8 5 5 4 --> fliplr(x) ans = (:,:,1) = 7 6 6 1 3 3 3 8 3 9 0 8 0 3 9 0 (:,:,2) = 5 5 2 8 9 3 7 9 2 3 6 1 4 7 6 3 (:,:,3) = 8 6 6 6 4 6 4 3 5 8 7 9 4 5 5 8 --> quit