Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

size

Size of Matrix


Description

Provides the dimensions of x.

Usage

size(x, k)

Arguments

x

vector, matrix, or array

k

integer specifying a particular dimension

Details

Returns the number of dimensions as length(x).

Vector will be treated as a single row matrix.

Value

vector containing the dimensions of x, or the k-th dimension if k is not missing.

Note

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

See Also

Examples

size(1:8)
size(matrix(1:8, 2, 4))		# 2 4
size(matrix(1:8, 2, 4), 2)	# 4
size(matrix(1:8, 2, 4), 3)	# 1

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.