Hello everyone,
I'm creating an app with matlab appdesigner, to dynamicly adjust some parameters in a running function. I want to design a slidebar such that I could adjust variables while the function is running, so that I could monitor the performance of the function in real time. Is there any way to achieve that?
Look forward to your help.

1 Kommentar

Jin Ren
Jin Ren am 5 Feb. 2021
@KSSV sorry I'm new to asking question, I just deleted the previous problem. Please refer to this new one.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Feb. 2021

0 Stimmen

If the function does not call pause or drawnow or uiwait or figure, then you need to go into the editor and trick it to open the file (which is sometimes only possible if it happens to be in the recent list or you happen to have the folder view open.) Once it is open, right click at the appropriate place to insert a breakpoint at a line and wait for execution to stop; then you can use the command line to change the value and then dbcont to continue.
In some cases you might need to resort to injecting a dbstopfor a lline tthat has a condition aattached to it, except that you make the condition be a call to a function that alters the variable as a side effect using assignin caller, and then returns false so that the debugger thinks the condition was not matched and continues execution.
Mostly though you should not do this, and should instead arrange to share a variable and have some gui that changes the variable value, with the loop checking for changes periodically.

1 Kommentar

Jin Ren
Jin Ren am 5 Feb. 2021
Actually what I want to do is exactly your last paragraph, and I just find that matlab works well with this. Thank you so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by