Clear Filters
Clear Filters

Button activity only works if I set a breakpoint in Matlab App Designer

1 view (last 30 days)
I have the App Designer code below that should make the Button invoking the script disappear while the script runs. At completion, I have a command "app.BeginoptimizationButton.Visible="on" to make the button available again. This only works if I put a breakpoint in the script at the place indicated below, and then it works as planned. Without the breakpoint, the button remains visible though the rest of the script runs flawlessly.
I have tried using a lamp to indicate when the script is running with exactly the same problem: the lamp doesn't change without a breakpoint at the line where the command is located.
I can't figure out what to do to fix this and would greatly appreciate any advice.
Thanks,
Andy
____________________________________________
% Button pushed function: BeginoptimizationButton
function BeginoptimizationButtonPushed(app, event)
'Starting optimization'
app.MinMethod='fminsearchbnd';
app.approachinfo=['Approach: Revised Starling model using ',app.MinMethod];
app.solverinfo='solver: ode15s';
<breakpoint> app.BeginoptimizationButton.Visible="off";
t=app.t;
etc.

Accepted Answer

Voss
Voss on 15 Nov 2023
Put a drawnow after lines of code that make changes to the GUI which should take effect immediately, e.g.:
% starting optimization
app.BeginoptimizationButton.Visible="off";
drawnow
% ...
% ...
app.BeginoptimizationButton.Visible="on";
drawnow

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!