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!