Basic plotting function not working in compiled version

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 日

1 投票

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 日

0 投票

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 shouldn't have used the phrase "Live Mode". This is simply a check box telling the user that parameter changes will replot the graphic (as opposed to redrawing the axes). The compiled version of a simple, one line, example worked as well, but I pressed on and modified the code to use hAllLines = findall(UIAxes, 'type', 'line') followed by delete(UIAxes, hAllLines) to clear all the lines. This worked fine in the MATLAB environment, but failed to update the graphic in the compiled version.
There is no interaction with the command window - everything is through the GUI. Both versions support the mouse button down callback so it's not a question of things getting hung up. I can generate a second UIAxes App window, it's this hot mode that doesn't work. At this point I'll have to embed some tracing so I can see what's going on.
Walter Roberson
Walter Roberson 2022 年 11 月 18 日
And do you have a drawnow() ?
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.

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

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

製品

リリース

R2022b

質問済み:

2022 年 11 月 17 日

回答済み:

2022 年 11 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by