Reverses an array along the given dimension. The syntax for its use is
y = flipdim(x,n)
where x is matrix, and n is the dimension to reverse.
The following examples show some uses of flipdim on N-dimensional
arrays.
--> x = int32(rand(4,5,3)*10)
x =
<int32> - size: [4 5 3]
(:,:,1) =
Columns 1 to 5
8 6 9 9 4
9 0 9 4 9
1 2 1 8 7
9 5 9 1 9
(:,:,2) =
Columns 1 to 5
6 6 6 2 6
0 7 1 0 3
8 7 7 0 9
9 3 0 8 0
(:,:,3) =
Columns 1 to 5
4 1 7 6 9
3 4 7 1 3
7 4 2 1 5
7 6 6 4 2
--> flipdim(x,1)
ans =
<int32> - size: [4 5 3]
(:,:,1) =
Columns 1 to 5
9 5 9 1 9
1 2 1 8 7
9 0 9 4 9
8 6 9 9 4
(:,:,2) =
Columns 1 to 5
9 3 0 8 0
8 7 7 0 9
0 7 1 0 3
6 6 6 2 6
(:,:,3) =
Columns 1 to 5
7 6 6 4 2
7 4 2 1 5
3 4 7 1 3
4 1 7 6 9
--> flipdim(x,2)
ans =
<int32> - size: [4 5 3]
(:,:,1) =
Columns 1 to 5
4 9 9 6 8
9 4 9 0 9
7 8 1 2 1
9 1 9 5 9
(:,:,2) =
Columns 1 to 5
6 2 6 6 6
3 0 1 7 0
9 0 7 7 8
0 8 0 3 9
(:,:,3) =
Columns 1 to 5
9 6 7 1 4
3 1 7 4 3
5 1 2 4 7
2 4 6 6 7
--> flipdim(x,3)
ans =
<int32> - size: [4 5 3]
(:,:,1) =
Columns 1 to 5
4 1 7 6 9
3 4 7 1 3
7 4 2 1 5
7 6 6 4 2
(:,:,2) =
Columns 1 to 5
6 6 6 2 6
0 7 1 0 3
8 7 7 0 9
9 3 0 8 0
(:,:,3) =
Columns 1 to 5
8 6 9 9 4
9 0 9 4 9
1 2 1 8 7
9 5 9 1 9