Learn R Programming

pracma (version 1.1.6)

ndims: Number of Dimensions

Description

Number of matrix or array dimensions.

Usage

ndims(x)

Arguments

x
a vector, matrix, array, or list

Value

  • the number of dimensions in the vector or array x.

Details

Returns the number of dimensions as length(x).

A vector is seen as a matrix with one row, i.e. for a vector the number of dimensions is 2.

See Also

size

Examples

Run this code
ndims(1:8)
ndims(array(1:8, c(2,2,2)))

Run the code above in your browser using DataLab