# isa

Determine if input has specified data type

## Syntax

``tf = isa(A,dataType)``
``tf = isa(A,typeCategory)``

## Description

example

````tf = isa(A,dataType)` returns `1` (`true`) if `A` has the data type specified by `dataType`. Otherwise, it returns `0` (`false`). The input argument `A` can have any data type.If `A` is an object, then `isa` returns `1` if `dataType` is either the class of `A` or a superclass of `A`.```

example

````tf = isa(A,typeCategory)` returns `1` (`true`) if the data type of `A` belongs to the category specified by `typeCategory`. Otherwise, it returns `0` (`false`).If `A` is an object, then `isa` returns `1` if the class of `A`, or any superclass of `A`, belongs to the specified category.```

## Examples

collapse all

Create a numeric variable and determine if its data type is `double`.

```A = 3.1416; tf = isa(A,'double')```
```tf = logical 1 ```

Create an array of 32-bit integers and determine if its data type is `int32`.

`A = int32([0 2 4 6 8])`
```A = 1x5 int32 row vector 0 2 4 6 8 ```
`tf = isa(A,'int32')`
```tf = logical 1 ```

Determine if the data type of `A` is `char`.

`tf = isa(A,'char')`
```tf = logical 0 ```

Create an array whose data type is `uint8`. Determine if the array has a data type that belongs to the `integer` category.

`A = uint8([0 2 4 6 8])`
```A = 1x5 uint8 row vector 0 2 4 6 8 ```
`tf = isa(A,'integer')`
```tf = logical 1 ```

Determine if the data type of `A` belongs to the `float` category.

`tf = isa(A,'float')`
```tf = logical 0 ```

## Input Arguments

collapse all

Input array.

Data type, specified as a character vector or string scalar. `dataType` can be the name of:

• Any fundamental data type or MATLAB® class

• A Java® or .NET class

The table shows the names of many commonly used MATLAB data types.

 `'half'` Half-precision number `'single'` Single-precision number `'double'` Double-precision number `'int8'` Signed 8-bit integer `'int16'` Signed 16-bit integer `'int32'` Signed 32-bit integer `'int64'` Signed 64-bit integer `'uint8'` Unsigned 8-bit integer `'uint16'` Unsigned 16-bit integer `'uint32'` Unsigned 32-bit integer `'uint64'` Unsigned 64-bit integer `'logical'` Logical `1` (`true`) or `0` (`false`) `'char'` Character `'string'` String array `'struct'` Structure array `'cell'` Cell array `'table'` Table `'function_handle'` Function handle

Data type category, specified as `'numeric'`, `'float'`, or `'integer'`. These values represent categories of numeric types, as shown in the table.

 `'numeric'` Integer or floating-point array, having one of these data types:`double``single``half``int8``int16``int32``int64``uint8``uint16``uint32``uint64` `'float'` Single- or double-precision floating-point array, having either of these data types:`double``single``half` `'integer'` Signed or unsigned integer array, having one of these data types:`int8``int16``int32``int64``uint8``uint16``uint32``uint64`

## Tips

• To test whether the input array is sparse, use the `issparse` function.

• To test whether the input array has any imaginary or complex elements, use `~isreal(A)`.

## Version History

Introduced before R2006a
{"ft_lang_label":"__label__en","ft_lang_prob":0.5037501,"math_prob":0.958762,"size":3015,"snap":"2022-05-2022-21","text_gpt3_token_len":814,"char_repetition_ratio":0.1431418,"word_repetition_ratio":0.10953347,"special_character_ratio":0.26235488,"punctuation_ratio":0.08791209,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9928087,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-18T08:01:07Z\",\"WARC-Record-ID\":\"<urn:uuid:894e7ac6-a90d-4361-8cd6-9e76d3d302b7>\",\"Content-Length\":\"98192\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:30a6cee1-8f7e-47ef-a765-1e0de93f4fec>\",\"WARC-Concurrent-To\":\"<urn:uuid:0756ad09-59d2-48d0-b607-d58b42f4f529>\",\"WARC-IP-Address\":\"104.69.217.80\",\"WARC-Target-URI\":\"https://es.mathworks.com/help/matlab/ref/isa.html\",\"WARC-Payload-Digest\":\"sha1:F6HTM3AIYVPMAYLXUOXUKRUJ5GHEEUT5\",\"WARC-Block-Digest\":\"sha1:RUCTZND2UJD2N63SPI53BR6OF3Z4A7JA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662521152.22_warc_CC-MAIN-20220518052503-20220518082503-00292.warc.gz\"}"}