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
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 个)

Richard
Richard 2022-11-20
Problem solved: some weeks ago I had inserted an exportgraphics command while debugging and forgottent to remove same. Without a full path the application was attempting to write to the Program File folder without permission.

Walter Roberson
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 个评论
Richard
Richard 2022-11-18
I have determined that the program exhibits this behavior only if the .exe has been installed to the Programs folder on the C drive. If I run the .exe from the distribution testing folder the problem does not occur. At the point where the user changes parameters and, essentially, requests a redraw of the lines within the UIAxes there are not external dependencies (i.e. files) where the location of the executable would matter.
This Q&A has hit a dead end. I can request my user(s) to copy the .exe into a convenient workspace and ignore the default installation location n Programs.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by