ndims

Returns the number of dimensions of an array.

Syntax

R = ndims(A)

Inputs

A
Any valid matrix.
Type: double | integer | logical | struct | cell
Dimension: matrix

Outputs

R
An integer value, the number of dimensions of the array.
Type: double
Dimension: scalar

Examples

Matrix input:
R = ndims([1,3,2;5,2,3])
R = 2
Complex matrix input:
R = ndims([1;7+9i;2i-1])
R = 2

Comments

ndims(A) is equivalent to length(size(A)).