ismethod - Determine if object has specified method - MATLAB (original) (raw)
Main Content
Determine if object has specified method
Syntax
Description
[tf](#mw%5F9fdf64ca-bcc2-4181-ac62-c6cb10e0a873) = ismethod([obj](#mw%5Fcc7a7008-2831-45ad-a7d8-6ba63959f984),[methodName](#mw%5F09398a1a-b240-470e-86ed-c2e36f9c8792))
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 take class names specified as character vectors or strings as the first argument to identify a class. To list the methods defined by a class using its class name, use the methods function.
Examples
Test for Equality
Determine if objects support equality testing before executing code.
if ismethod(obj1,'eq') && ismethod(obj2,'eq') tf = obj1 == obj2; end
Input Arguments
Object of class defining method, specified as an instance of the class.
Data Types: object
Name of the method potentially defined by the class of the first input argument, specified as a character vector or string scalar.
Data Types: char
| string
Output Arguments
True if class of object define specified method, returned as a 1 or 0 or data type logical
.
Extended Capabilities
Version History
Introduced before R2006a