Main Content

size

(Not Recommended) Size of dataset array

The dataset data type is not recommended. To work with heterogeneous data, use the MATLAB® table data type instead. See MATLAB table documentation for more information.

Syntax

D = SIZE(A)
[NOBS,NVARS] = SIZE(A)
[M1,M2,M3,...,MN] = SIZE(A)
M = size(A,dim)

Description

D = SIZE(A) returns the two-element row vector D = [NOBS,NVARS] containing the number of observations and number of variables in the dataset A. A dataset array always has two dimensions.

[NOBS,NVARS] = SIZE(A) returns the numbers of observations and variables in the dataset A as separate output variables.

[M1,M2,M3,...,MN] = SIZE(A), for N > 2, returns M1 = NOBS, M2 = NVARS, and M3,..,MN = 1.

M = size(A,dim) returns the length of the dimension specified by the scalar dim:

  • M = size(A,1) returns NOBS

  • M = size(A,2) returns NVARS

  • M = size(A,k) returns 1 for k > 2

See Also

| |