Can I pass arguments to a @callbackFcn?
古いコメントを表示
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 件のコメント
Rik
2021 年 7 月 29 日
採用された回答
その他の回答 (1 件)
Bruno Luong
2021 年 7 月 29 日
% Assuming operation,mode are defined
% operation = ...
% mode = ...
configureCallback(s,"terminator",@(s,t) readSerialData(s, t, operation, mode));
カテゴリ
ヘルプ センター および File Exchange で Serial and USB Communication についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!