Files in a subfolder of a class folder are not considered methods of the class.
Please refer to the following example:
@myClass > myClass.m:
classdef myClass
methods
function classObj = myClass()
classObj.method1()
classObj.method2()
end
end
end
@myClass > method1.m:
function method1(classObj)
disp('method in class folder')
end
@myClass > subfolder > method2.m:
function method2(classObj)
disp('method in subfolder')
end
-----
>> m = myClass
method in class folder
Unrecognized method, property or field 'method2' for class 'myClass'.
Error in myClass (line 5)
classobj.method2()
As you can see, 'method1' is part of the class, but 'method2', which is in a subfolder of '@myClass', is not treated as a method of the class.
For more details about using class folders in MATLAB, please see the following documentation page:
Best Answer