isobject

Tests whether a value is an object of a MATLAB class.

Category: Language Fundamentals > Data Types

Syntax

tf = isobject(A)

Returns true if A is an object.

Description

Plain data such as numbers, text, structs and cell arrays are not objects, so the result is false. Instances of user-defined and handle classes are objects. Java objects are not covered by this function; use isjava for those.

Input arguments

A
Any value.

Output arguments

tf
Logical scalar.

Example

Plain data are not objects

isobject(1)
isobject('text')
isobject(struct('a', 1))
Output
ans = logical
   0
ans = logical
   0
ans = logical
   0

See also

isjava isstruct class isa ishandle