SIZE Size of a Variable

Section: Inspection Functions

Usage

Returns the size of a variable. There are two syntaxes for its use. The first syntax returns the size of the array as a vector of integers, one integer for each dimension
  [d1,d2,...,dn] = size(x)

The other format returns the size of x along a particular dimension:

  d = size(x,n)

where n is the dimension along which to return the size.

Example

--> a = randn(23,12,5);
--> size(a)
ans = 
  <uint32>  - size: [1 3]
 
Columns 1 to 3
 23  12   5  

Here is an example of the second form of size.

--> size(a,2)
ans = 
  <uint32>  - size: [1 1]
 12