FreeMat
|
Section: Array Generation and Manipulations
Reverses the rows of a matrix. The syntax for its use is
y = flipud(x)
where x
is matrix. If x
is an N-dimensional array then the first dimension is reversed.
The following example shows flipud
applied to a 2D matrix.
--> x = int32(rand(4)*10) x = 9 4 5 3 8 9 7 4 4 8 6 3 6 7 0 9 --> flipud(x) ans = 6 7 0 9 4 8 6 3 8 9 7 4 9 4 5 3
For a 3D array, note how the rows in each slice are flipped.
--> x = int32(rand(4,4,3)*10) x = (:,:,1) = 7 4 3 3 0 10 10 6 2 8 1 8 1 1 9 8 (:,:,2) = 4 4 3 2 4 4 7 1 4 9 9 8 5 5 1 6 (:,:,3) = 9 7 7 5 8 9 5 6 5 10 6 8 4 2 8 3 --> flipud(x) ans = (:,:,1) = 1 1 9 8 2 8 1 8 0 10 10 6 7 4 3 3 (:,:,2) = 5 5 1 6 4 9 9 8 4 4 7 1 4 4 3 2 (:,:,3) = 4 2 8 3 5 10 6 8 8 9 5 6 9 7 7 5