size - Symbolic matrix dimensions

Syntax

d = size(A)
[m,n] = size(A)
d = size(A,n)

Description

Suppose A is an m-by-n symbolic or numeric matrix. The statement d = size(A) returns a numeric vector with two integer components, d = [m,n].

The multiple assignment statement [m,n] = size(A) returns the two integers in two separate variables.

The statement d = size(A,n) returns the length of the dimension specified by the scalar n. For example, size(A,1) is the number of rows of A and size(A,2) is the number of columns of A.

Examples

The statements

syms a b c d
A = [a b c ; a b d; d c b; c b a];
d = size(A)
r = size(A, 2)

return

d =
     4     3

r =
     3

See Also

length, ndims in the online MATLAB® Function Reference

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS