1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>FLIPUD Reverse the Columns of a Matrix
</TITLE>
</HEAD>
<BODY>
<H2>FLIPUD Reverse the Columns of a Matrix
</H2>
<P>
Section: <A HREF=sec_array.html> Array Generation and Manipulations </A>
<H3>USAGE</H3>
Reverses the rows of a matrix. The syntax for its use is
<PRE>
y = flipud(x)
</PRE>
<P>
where <code>x</code> is matrix. If <code>x</code> is an N-dimensional array then
the first dimension is reversed.
<H3>Example</H3>
The following example shows <code>flipud</code> applied to a 2D matrix.
<PRE>
--> x = int32(rand(4)*10)
x =
0 7 2 6
5 7 10 1
2 6 8 0
1 0 9 8
--> flipud(x)
ans =
1 0 9 8
2 6 8 0
5 7 10 1
0 7 2 6
</PRE>
<P>
For a 3D array, note how the rows in each slice are flipped.
<PRE>
--> x = int32(rand(4,4,3)*10)
x =
(:,:,1) =
8 4 6 7
6 0 7 6
8 9 9 0
1 2 10 5
(:,:,2) =
9 6 2 8
3 10 1 7
6 10 9 8
3 2 4 2
(:,:,3) =
3 1 5 0
0 6 5 1
9 4 9 2
6 10 8 10
--> flipud(x)
ans =
(:,:,1) =
1 2 10 5
8 9 9 0
6 0 7 6
8 4 6 7
(:,:,2) =
3 2 4 2
6 10 9 8
3 10 1 7
9 6 2 8
(:,:,3) =
6 10 8 10
9 4 9 2
0 6 5 1
3 1 5 0
</PRE>
<P>
</BODY>
</HTML>
|