Debugger running different code than normal runner
Ältere Kommentare anzeigen
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

Antworten (1)
Walter Roberson
am 30 Aug. 2022
Verschoben: Steven Lord
am 31 Aug. 2022
0 Stimmen
Add a drawnow() ?
5 Kommentare
Steven Lord
am 31 Aug. 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
am 31 Aug. 2022
Technically, debugger counts as using keyboard() , which is why the prompt is K>>
Mingda He
am 31 Aug. 2022
Walter Roberson
am 31 Aug. 2022
please post the code for testing... my version of MATLAB cannot execute pictures of code.
Mingda He
am 1 Sep. 2022
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!