ISA Test Type of Variable

Section: Inspection Functions

Usage

Tests the type of a variable. The syntax for its use is
   y = isa(x,type)

where x is the variable to test, and type is the type. Supported built-in types are

If the argument is a user-defined type (via the class function), then the name of that class is returned.

Examples

Here are some examples of the isa call.
--> a = {1}

a = 
 [1] 

--> isa(a,'char')

ans = 
 0 

--> isa(a,'cell')

ans = 
 1 

Here we use isa along with shortcut boolean evaluation to safely determine if a variable contains the string 'hello'

--> a = 'hello'

a = 
hello
--> isa(a,'char') && strcmp(a,'hello')

ans = 
 1