k-Wave Toolbox

numDim

Return the number of matrix dimensions.

Syntax

dim = numDim(x)

Description

numDim returns the number of dimensions of a matrix x. Unlike the inbuilt ndims, numDim returns 1 for 1D vectors, 2 for 2D arrays, etc.

Inputs

x matrix with unknown number of dimensions

Outputs

dim number of dimensions

See Also

ndims