R: Number of Dimensions

ndims {pracma} | R Documentation

## Number of Dimensions

### Description

Number of matrix or array dimensions.

### Usage

    ndims(x)

### Arguments

`x` | a vector, matrix, array, or list

### 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.

### Value

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

### Note

The result will differ from Matlab when `x` is a character vector.

### See Also

`size`

### Examples

    ndims(1:8)
    ndims(array(1:8, c(2,2,2)))

[Package pracma version 2.0.4 Index]