0

I have created an app using the App Designer in Matlab. I have a check box called CheckBox and want to access its value from inside a loop, e.g. display it in the console. The way this could be done is

while true
    disp(app.CheckBox.Value);
end

And while it technically works, this only ever displays the value the check box had before the loop started. Even if I change the value by checking and unchecking the box respectively, the value that is read by app.CheckBox.Value remains the same.

If I add a pause(0.1); statement into the loop, then the value is able to update, but that slows down the loop significantly. Is there any other way to make sure the value of the check box (and any other component in the app) is updated correctly without having to pause the entire program?

1 Answer 1

0

The trick is done by adding drawnow; to the loop, which forces a gui update but doesn't add a deliberate delay.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .