Calling function handles of one class from another class

Hi,
I have two classes namely "Acquisition" and "DataStream". Inside the "Acquisition" class I'm creating an object of "DataStream" class. I have one public function in "Acquisition" class whose handle I'm passing to the one of the properties of the "DataStream" class. Inside the "DataStream" class I've one function in which I want to call the function of the "Acquisition" class with help of the function handle. I'm attaching the code snippet for this :
classdef Acquisition < abc.efg.Class
properties
dataStreamObj
..
end
methods
function PQR(obj)
obj.dataStreamObj = xyz.pqr.efg.DataStream();
obj.dataStreamObj.callbacks = @(~,evnt)obj.samplesRecv(evnt.data,evnt.errorMessage);
end
function samplesRecv(obj,inputSamples,err)
% Some processing
end
end
end
classdef DataStream < handles
properties
callbacks
dataRecv
..
end
methods
function RST(obj)
obj.dataRecv = @(~,evnt)obj.callbackSamplesDAQmx(evnt.data,evnt.errorMessage);
end
function callbackSamplesDAQmx(obj,inputSamples,err )
% Here I want to call the samplesRecv function of the Acquisition class with the above arguments
% I have the function handle of the samplesRecv function in the callbacks property of the DataStream class
end
end
end
Can anyone please suggest how to do this ?
Thanks,

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by