Basic plotting function not working in compiled version

7 visualizaciones (últimos 30 días)
Richard
Richard el 17 de Nov. de 2022
Respondida: Richard el 20 de Nov. de 2022
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 comentario
Adam Danz
Adam Danz el 17 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (2)

Richard
Richard el 20 de Nov. de 2022
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 el 17 de Nov. de 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 comentarios
Walter Roberson
Walter Roberson el 18 de Nov. de 2022
And do you have a drawnow() ?
Richard
Richard el 18 de Nov. de 2022
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by