Method on @sym: d = size (x)
Method on @sym: [n, m] = size (x)
Method on @sym: d = size (x, dim)

Return the size of a symbolic array.

Examples:

syms x
A = [1 2 x; x 3 4];
[n, m] = size(A)
  ⇒ n = 2
  ⇒ m = 3

A = sym('a', [3 4]);
[n, m] = size(A)
  ⇒ n = 3
  ⇒ m = 4
size(A, 1)
  ⇒ 3
size(A, 2)
  ⇒ 4

Symbolic-sized matrices currently return 1 × 1 but we might prefer NaN × NaN:

syms n m integer
A = sym('a', [n m])
  ⇒ A = (sym) a  (n×m matrix expression)

size(A)          % doctest: +XFAIL
  ⇒ NaN   NaN

See also: @sym/length, @sym/numel.

Package: symbolic