Consider the following definition of a Matlab class:
classdef myClass < handle
properties
cnn
factor
end
methods
function obj = myClass()
if nargin>0
obj.cnn = CNN();
obj.factor = Factor();
featureHandle = @obj.cnn.getFeature;
factor.setCNN(featureHandle);
end
end
end
end
cnn and factor are instances of two other classes CNN and Factor. The CNN class has a function getFeature and the Factor class has a function setCNN.
My goal is to let factor use the getFeature method of the CNN class, e.g.,
c = myClass;
c.factor.cnnHandle(input);
But the code above doesn't work, because Matlab seems to look for a property cnn in the Factor class, probably because the handle uses obj to refer to the current class:
Undefined function 'obj.cnn.getFeature' for input arguments of type 'double'.