isscalar - Determine whether input is scalar

Syntax

TF = isscalar(A)

Description

TF = isscalar(A) returns logical 1 (true) if A is a 1-by-1 matrix, and logical 0 (false) otherwise.

The A argument can be a structure or cell array. It also be a MATLAB object, as described in Object-Oriented Programming, as long as that object overloads the size function.

Examples

Test matrix A and one element of the matrix:

A = rand(5);

isscalar(A)
ans =
     0

isscalar(A(3,2))
ans =
     1

See Also

isvector, isempty, isnumeric, islogical, ischar, isa, is*

  


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