Basic plotting function not working in compiled version
14 次查看(过去 30 天)
显示 更早的评论
I've developed a GUI in App Designer for creating graphics for analysis. User enters parameters (data field and/or slider), hits "Run" and a multi-line (2D) graphic appears. When in "Live Mode" the graphic will update when the user updates the data, the axes and other peripheral information remaining unchanged. This is accomplished simply using hold on and hold off. Hold is on during the initial graphic redraw and is changed to off after the first plot command of the redraw.
This works perfectly in the MATLAB environment. Everything except this redraw works using the .exe file. I'm not sure how to trouble shoot this issue.
I'm going to create a very simple example, compile same, and see if I can duplicate the issue, but any insight in the meantime would be appreciated.
1 个评论
Adam Danz
2022-11-17
It's not clear to me how the plot is behaving when deployed and how you expect it to behave.
A snippet of code may be helpful to see, too.
回答(2 个)
Walter Roberson
2022-11-17
MATLAB redraws the screen under any of several different circumstances:
- figure() is called, either to create a new figure or to activate an existing figure. These days I suppose uifigure() should be included in this
- pause() is called.
- uiwait() or waitfor() are called
- MATLAB returns to the command line, either because it has run out of commands in a script or function, or because keyboard() is called, or because a breakpoint is hit, or because "dbstop if error" and an uncaught error is encountered
- drawnow() is called
When you are using Live Script in interactive mode, MATLAB is returning to the command line after action from clicking a button is finished.
However when you compile, returning to the command line due to running out of things to do would be interpreted by MATLAB as indicating that the executable is finished and should terminate. So when you compile, you need to build in an endless loop or other way of never finishing until the user indicates they are ready to exit. And that means that if you do not have figure() or pause() or uiwait() or waitfor() or drawnow() calls, that your screen is not going to update.
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!