Basic plotting function not working in compiled version
16 views (last 30 days)
Show older comments
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 Comment
Adam Danz
on 17 Nov 2022
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.
Answers (2)
Walter Roberson
on 17 Nov 2022
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 Comments
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!