Return the number rows and columns of a.
With one input argument and one output argument, the result is returned in a row vector. If there are multiple output arguments, the number of rows is assigned to the first, and the number of columns to the second, etc. For example,
size ([1, 2; 3, 4; 5, 6]) [ 3, 2 ] [nr, nc] = size ([1, 2; 3, 4; 5, 6]) nr = 3 nc = 2If given a second argument,
size
will return the size of the corresponding dimension. For examplesize ([1, 2; 3, 4; 5, 6], 2) 2returns the number of columns in the given matrix.
See also: numel