Why does my GUI code sometimes not update when debugging / making changes on the fly?
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Ryan
il 31 Mag 2016
Commentato: Jeff Grothaus
il 18 Apr 2024
I am writing another GUI for making my life easier when processing common datasets. This is without using guide or anything, just creating axes, tabs, buttons, etc using the uicontrol commands, then running various processing techniques within the GUI. My question (which has always bugged me), is why sometimes when I make a small change to code that the GUI uses, this change is not registered during debugging.
In fact, even if I close and reopen the GUI figure window, the code does not seem to update. It sometimes takes closing Matlab down completely, then reopening in order for the code change to "register". As an example, let's say I am plotting something and want to make a small change that plots an additional point or line or something. I press the button or interact with the GUI in whatever way re-runs that code, but nothing happens. If I run it in debug mode, sometimes it will skip the line entirely, but other times it will seem to step through the new code, just using wrong values (from a previous iteration or whatever). In these cases, it takes a whole shutting down and reopening of Matlab to get the code to behave the way I expect!
Is there some kind of underlying "compiling" that goes on during GUI generation that causes this issue? I have never seen behavior like this when simply running scripts, etc., only when working with GUIs. If there is some kind of compiling that goes on, is it possible to disable this or force it to "recompile" just by restarting the GUI (rather than all of Matlab)? Am I the only one experiencing issues like this? It's annoying when you are debugging and working out details of a GUI on a daily basis.
1 Commento
Jeff Grothaus
il 18 Apr 2024
I am having this same problem when making GUI code changes (using App Builder) in 2024. I am using R2023a on Win10. As an example, changing "if ..." to "if ~..." does not change the behavior when the function is executed, say from a button on the GUI.
The link in Walter's solution to the jit accelerator no longer points to a valid page. Additionally, neither clearing the function nor setting "feature accel off" seem to affect this behavior. All hits for searches along the lines of "just in time accelerator" in the MatLab docs point to Simulink pages.
I had thought that the code generated by App Builder had been corrupted by switching from R2022a to R2023a and back, however, I just rebuilt the GUI only using R2023a and the problem persists.
Any thoughts would be appreciated.
Risposta accettata
Walter Roberson
il 31 Mag 2016
Use "clear" and the name of the function.
Yes, there is Just In Time Compiling. The function will normally be cleared automatically if MATLAB detects that the containing file is changed, but there are various ways that might not be detected.
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!