# isscalar

Determine whether input is scalar

## Syntax

``TF = isscalar(A)``

## Description

example

````TF = isscalar(A)` returns logical `1` (`true`) if `A` is a scalar. Otherwise, it returns logical `0` (`false`). A scalar is a two-dimensional array that has a size of 1-by-1.```

## Examples

collapse all

Create a 2-by-2 matrix. Determine whether it is a scalar.

```A = [1 2; 3 4]; TF = isscalar(A)```
```TF = logical 0 ```

Check whether the element at the first row and second column of the matrix is a scalar.

`TF = isscalar(A(1,2))`
```TF = logical 1 ```

Create a string scalar by enclosing a piece of text in double quotes. Determine whether it is a scalar.

```A = "Hello, World!"; TF = isscalar(A)```
```TF = logical 1 ```

Now create a character vector by enclosing a piece of text in single quotes. Determine whether it is a scalar.

```B = 'Hello, World!'; TF = isscalar(B)```
```TF = logical 0 ```

Check the dimension of `B` using `size`. `B` is not a scalar since it has a size of 1-by-13.

`sz = size(B)`
```sz = 1×2 1 13 ```

## Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array.

## Version History

Introduced before R2006a