Can I pass arguments to a @callbackFcn?
Ältere Kommentare anzeigen
Hello,
I am reading some data from a serialport by using this function:
configureCallback(s,"terminator",@readSerialData)
The function looking like this
function readSerialData(s,~)
...
end
But how can I do to use arguments in the @readSerialData, for example I want to use this two arguments
function readSerialData(s,~,operation,mode)
...
end
How can I "pass" these two variables from the "configureCallback" line to the function?
Thank you!!
1 Kommentar
Rik
am 29 Jul. 2021
Akzeptierte Antwort
Weitere Antworten (1)
Bruno Luong
am 29 Jul. 2021
% Assuming operation,mode are defined
% operation = ...
% mode = ...
configureCallback(s,"terminator",@(s,t) readSerialData(s, t, operation, mode));
1 Kommentar
Javier Mateo
am 30 Jul. 2021
Kategorien
Mehr zu Serial and USB Communication finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!