Determine Array Class
In this section...
“Query the Class Name” on page 12-87
“Test for Array Class” on page 12-87
“Test for Specific Types” on page 12-88
“Test for Most Derived Class” on page 12-89Query the Class Name
To determine the class of an array, use the class function:a = [2,5,7,11];
class(a)ans =
doublestr = 'Character array';
class(str)ans =
charTest for Array Class
The isa function enables you to test for a specific class or a category of numeric class
(numeric, float, integer):a = [2,5,7,11];
isa(a,'double')ans =
1Floating-point values (single and double precision values):isa(a,'float')ans =
1Determine Array Class