Using the C Math Library    

Determining Array Type

The MATLAB C Math Library includes several routines that allow you to determine the type of an array. Each routine tests for a particular type of array and returns 1 if the array being tested matches the indicated type and 0 (zero) otherwise.

Table 3-6: Array Type Routines
Array Type
Routine
Numeric array
mlfIsnumeric()
Character array
mlfIschar()
Sparse array
mlfIssparse()
Cell array
mlfIscell()
Cell array of strings
mlfIscellstr()
Structure
mlfIsstruct()

As an example, the following code uses the mlfIsnumeric() routine to test if a 2-by-2 array of ones is a numeric array.

Because the array created is numeric, this code produces the following output:


 Displaying MATLAB Arrays Determining Array Size