ismethod

Determine if method of object

Syntax

tf = ismethod(obj,methodName)

Description

tf = ismethod(obj,methodName) returns logical 1 (true) if the specified methodName is a nonhidden, public method of object obj. Otherwise, ismethod returns logical 0 (false). The methodName argument is the name of the method specified as a character vector or a string scalar.

ismethod does not accept class names specified as character vectors or strings as the first argument.

Use the methods function to list the methods of abstract classes.

Examples

Determine if objects support equality testing:

if ismethod(obj1,'eq') && ismethod(obj2,'eq')
   tf = obj1 == obj2;
end

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a