MATLAB: How to use the ISMETHOD function to determine if an inherited method belongs to a derived object for classes created in MATLAB R2007b or before

classesinheritanceismethodMATLABmethodsobjectoopr2007ar2007b

I am using the MATLAB R2007b classes system, and I would like to use ISMETHOD to check if a particular method belongs to an instance of a derived class. However, if the method is defined is the base class ISMETHOD returns false.

Best Answer

The ability to do use ISMETHOD on methods defined in a base class is not available in the MATLAB classes system for MATLAB R2007b and before.
This functionality has been added in the MATLAB classes system starting with R2008a.
To work around this issue in releases prior to R2008a, search the output of the METHODS function using the '-full' parameter. For example, if 'd' is an instance of the derived class, and 'theMethod' is a method defined in the base class:
method_list = methods(d, '-full');
if any(strcmp(method_list, 'theMethod'))
disp('theMethod is defined for d');
end