flipdim

Reverses the order of elements along a dimension (older name of flip).

Category: Language Fundamentals > Matrices and Arrays

Syntax

B = flipdim(A, dim)

Reverses A along dimension dim.

Description

flipdim(A, dim) returns the same result as flip(A, dim). The name is kept for old code; new code should call flip. Unlike flip, the dimension is required.

Input arguments

A
Array of any type.
dim
Dimension to reverse.

Output arguments

B
Array of the same size as A.

Example

flipdim([1 2; 3 4], 1)
flipdim([1 2; 3 4], 2)
Output
ans = 2×2

     3     4
     1     2
ans = 2×2

     2     1
     4     3

See also

flip fliplr flipud permute