isscalar
Test whether the input is a 1×1 scalar.
Syntax
Section titled “Syntax”tf = isscalar(A)Description
Section titled “Description”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.
Examples
Section titled “Examples”isscalar(7) % 1isscalar([1 2 3]) % 0isscalar([]) % 0isscalar('hello') % 0 (strings of length > 1 are vectors)