Main Content

Array size

returns a row
vector whose elements are the lengths of the corresponding dimensions of
`sz`

= size(`A`

)`A`

. For example, if `A`

is a 3-by-4 matrix,
then `size(A)`

returns the vector `[3 4]`

.

If `A`

is a table or timetable, then `size(A)`

returns
a two-element row vector consisting of the number of rows and the
number of table variables.

returns the length of dimension `szdim`

= size(`A`

,`dim`

)`dim`

when `dim`

is a positive integer scalar. Starting in R2019b, you can also specify
`dim`

as a vector of positive integers to query multiple
dimension lengths at a time. For example, `size(A,[2 3])`

returns
the lengths of the second and third dimensions of `A`

in the 1-by-2
row vector `szdim`

.

returns the lengths of dimensions `szdim`

= size(`A`

,`dim1,dim2,…,dimN`

)`dim1,dim2,…,dimN`

in the row
vector `szdim`

(starting in R2019b).

`[`

returns the lengths of the queried dimensions of `sz1,...,szN`

] = size(___)`A`

separately.