- write the code all on one line. MATLAB checks for interrupts at the beginning of each line of code, so if you write it all on one line then there will be no opportunity to interrupt
- write the code entirely in terms of built-in functions. You might have prevented interrupts by writing all on one line, but if what you are calling is MATLAB code that was written on multiple lines then MATLAB will be checking for interrupts at the beginning of those lines.
- do not call pause() or uifigure() or figure() or uiwait() or waitfor() or drawnow()
Configure a callback in App Designer to be non-interruptable
13 ビュー (過去 30 日間)
古いコメントを表示
I'm using USB connected Arduino device and have the following line:
configureCallback(app.PicoCom,"terminator",@app.PicoInput);
The function app.PicoInput does it's job, but I would like it to complete before going back to the main program. If a function has a component that calls it then the function will be the "callback area" of the app and the component has callback execution control. Since this function is called by an interrupt and is set up by startupFcn(app) it doesn't have a component. How can I make it non-interruptable without messing with flags and mutex?
0 件のコメント
採用された回答
Walter Roberson
2025 年 7 月 18 日
The secrets to making a function uninterruptible is:
5 件のコメント
Walter Roberson
約9時間 前
function InitInBuffer(app)
% Clean out InBuffer reset pointers
app.InBuffer = zeros(40, 2); % Circular Array init
You are not returning app from the function, and app is not a global variable or a shared variable. All changes to app will be lost when the funtion returns.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dialog Boxes についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!