Debugger running different code than normal runner
Mostrar comentarios más antiguos
Hello, I've been using app designer to try and create a UI for some analysis that we're currently doing. When I try to change the axes/plot positions, it works when I run it using debug mode, but it does not work when I run it normally.
I was able to recreate it with a simple test case.
Adding two axes in a simple grid layout (image 1) with the following code (image 2):
app.UIAxes.Position = [100 150 200 300];
app.UIAxes2.Position = [300 350 400 500];
If I were to put a breakpoint on the first line, press run and then continue, the results are what is expected with the graphs out of place (image 3). However, if I were to run it without any breakpoints, the runner treats it as if the code wasn't there (image 4). I was wondering if someone could help me get it to work normally, without having to use breakpoints to work around this bug.
Image 1

image 2

image 3

image 4

Respuestas (1)
Walter Roberson
el 30 de Ag. de 2022
Movida: Steven Lord
el 31 de Ag. de 2022
0 votos
Add a drawnow() ?
5 comentarios
Steven Lord
el 31 de Ag. de 2022
That was my first thought as well. The reason that your code running in debug mode may not need a drawnow is, I believe, related to the More About section on the documentation page for the drawnow function.
"These actions are equivalent to calling a full drawnow command:
- Returning to the MATLAB® prompt.
- Using the getframe, pause, and waitfor functions.
- Using functions that wait for user input, such as waitforbuttonpress, input, keyboard, or ginput."
I believe reaching the debug prompt K>> counts as the first bullet.
Walter Roberson
el 31 de Ag. de 2022
Technically, debugger counts as using keyboard() , which is why the prompt is K>>
Mingda He
el 31 de Ag. de 2022
Walter Roberson
el 31 de Ag. de 2022
please post the code for testing... my version of MATLAB cannot execute pictures of code.
Mingda He
el 1 de Sept. de 2022
Categorías
Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!