Skip to content

isscalar

Test whether the input is a 1×1 scalar.

tf = isscalar(A)

Returns true when A has exactly one element (size 1 along every dimension), and false otherwise. Always returns a single boolean — there is no elementwise variant.

isscalar(7) % 1
isscalar([1 2 3]) % 0
isscalar([]) % 0
isscalar('hello') % 0 (strings of length > 1 are vectors)
  • isvector — Test whether the input is a vector (one row or one column).
  • isempty — Test whether the input has zero elements.
  • size — Sizes along all dimensions, or along one specific dimension.
  • numel — Total number of elements.