How to close properly an app (built with Matlab App Designer) ?

66 ビュー (過去 30 日間)
Ulysse Bisiaux
Ulysse Bisiaux 2017 年 9 月 28 日
コメント済み: Andrew Eldredge 2021 年 4 月 13 日
Hey,
I built a Matlab App Designer App for some kind of real time measurements. It communicates with Arduino by RS232... When I want to close the App, the Arduino continues to send some datas... and so the following procedure does not work: disp('FERMETURE DE L''APPLICATION'); %fclose(app.COM_A); fclose(app.COM_B); delete(app);
I also get the following error:
"Invalid or deleted object.
Error in app_v4/serial_data_available_B (line 125) app.oldTempsCOM_B=tempsCOM_B;
Error in app_v4>@(varargin)app.serial_data_available_B(varargin{:}) (line 168) app.COM_B.BytesAvailableFcn = @app.serial_data_available_B;
Error in instrcb (line 42) feval(val{1}, obj, eventStruct, val{2:end});
Warning: The BytesAvailableFcn is being disabled. To enable the callback property either connect to the hardware with FOPEN or set the BytesAvailableFcn property."

採用された回答

Melissa Williams
Melissa Williams 2017 年 10 月 16 日
App Designer provides a closeRequest callback function which may be what you need. If you right click on the UIFigure in App Designer and select callbacks and select "Add closeRequestFcn callback, you can write the code you need to execute when you close the app to disconnect from the Arduino.

その他の回答 (1 件)

Prashant Gautam
Prashant Gautam 2018 年 3 月 30 日
use
app.delete;
  2 件のコメント
Simeon Georgiev
Simeon Georgiev 2018 年 12 月 11 日
Hey,
Would this call the CloseReqest if there is one?
Andrew Eldredge
Andrew Eldredge 2021 年 4 月 13 日
It does not appear to.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Arduino Hardware についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by