isscalar

Tests if a value is a scalar.

Syntax

R = isscalar(A)

Inputs

A
The input to be tested to determine if it is a scalar.
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix

Outputs

R
R is a logical value indicating whether A is a scalar.

Example

Scalar example:

R = isscalar(1)
R = 1
Matrix example:
R = isscalar([1,2;3,4])
R = 0
Logical example:
R = isscalar(true)
R = 1
Character example:
R = isscalar('Q')
R = 1