isobject - Determine if input is MATLAB object

Syntax

tf = isobject(A)

Description

tf = isobject(A) returns logical 1 (true) if A is a MATLAB object and logical 0 (false) otherwise. Note that Handle Graphics objects return false. Use ishandle to test for Handle Graphics

Examples

Suppose you define the following MATLAB class:

classdef button < handle
   properties
      UiHandle
   end
   methods
      function obj = button(pos)
         obj.UiHandle = uicontrol('Position',pos,...
            'Style','pushbutton');
      end
   end
end

You can use isobject to determine what objects are instances of MATLAB classes. For example:

h = button([20 20 60 60]);
isobject(h)
ans =
     1
isobject(h.UiHandle)
ans =
     0

Note that isjava, which tests for Sun Java objects in MATLAB, returns false for MATLAB objects:

isjava(h)
ans =
     0

For more information on MATLAB classes and objects, see: MATLAB Classes Overview.

See Also

isjava, isstruct, iscell, ischar, isnumeric, islogical, methods, class, isa, is*

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS