Programming

Data Types Used in the Matrix

These functions test elements of a matrix for a specific data type.

 Function Description `isa` Detect if input is of a given data type. `iscell` Determine if input is a cell array. `iscellstr` Determine if input is a cell array of strings. `ischar` Determine if input is a character array. `isfloat` Determine if input is a floating-point array. `isinteger` Determine if input is an integer array. `islogical` Determine if input is a logical array. `isnumeric` Determine if input is a numeric array. `isreal` Determine if input is an array of real numbers. `isstruct` Determine if input is a MATLAB structure array.

Example Using isnumeric and isreal

Pick out the real numeric elements from this vector:

• ```A = [5+7i 8/7 4.23 39j pi 9-2i];

for m = 1:numel(A)
if isnumeric(A(m)) && isreal(A(m))
disp(A(m))
end
end
```

The values returned are

• ```    1.1429
4.2300
3.1416
```

 Getting Information About a Matrix Data Structures Used in the Matrix