flipdim
flipdim(A, d)
Reverse A
in dimension d
.
Examples
julia> A = [1 2 3; 4 5 6; 7 8 9];
julia> flipdim(A, 1)
3×3 Matrix{Int64}:
7 8 9
4 5 6
1 2 3
In this example, the function flipdim
is used to reverse the matrix A
along dimension 1.
julia> B = [1 2 3; 4 5 6; 7 8 9];
julia> flipdim(B, 2)
3×3 Matrix{Int64}:
3 2 1
6 5 4
9 8 7
Here, the function flipdim
is used to reverse the matrix B
along dimension 2.
Common mistake example:
julia> C = [1 2 3; 4 5 6; 7 8 9];
julia> flipdim(C, 3)
ERROR: DimensionError: axis=3 exceeds array dimensions
In this example, the provided dimension exceeds the dimensions of the array C
. It is important to ensure that the dimension is within the valid range for the given array.
See Also
User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.