Can I pass arguments to a @callbackFcn?
Afficher commentaires plus anciens
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 commentaire
Rik
le 29 Juil 2021
Réponse acceptée
Plus de réponses (1)
Bruno Luong
le 29 Juil 2021
% Assuming operation,mode are defined
% operation = ...
% mode = ...
configureCallback(s,"terminator",@(s,t) readSerialData(s, t, operation, mode));
1 commentaire
Javier Mateo
le 30 Juil 2021
Catégories
En savoir plus sur System Composer 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!