External Interfaces/API |
Determining the Class of an Object
To find the class of a Java object, use the query form of the MATLAB function, class
. After execution of the following example, frameClass
contains the name of the package and class that Java object frame
instantiates.
Because this form of class
also works on MATLAB objects, it does not, in itself, tell you whether it is a Java class. To determine the type of class, use the isjava
function, which has the form
isjava
returns 1
if obj
is Java, and 0
if it is not.
To find out whether or not an object is an instance of a specified class, use the isa
function, which has the form
isa
returns 1
if obj
is an instance of the class named 'class_name
', and 0
if it is not. Note that 'class_name
' can be a MATLAB built-in or user-defined class, as well as a Java class.
Accessing Private and Public Data | Invoking Methods on Java Objects |