GUI stops after initialization code
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Laura F
am 4 Okt. 2019
Bearbeitet: Adam Danz
am 26 Dez. 2019
The GUI was running. Then I added another push button in GUIDE. After that I tried to run the GUI again, but it doesnt work anymore. I figured out, that its only executing until the end of the initialization code. Other breakpoints are not even reached. Restarting Matlab doesnt help either. What could be the problem her?
11 Kommentare
Rik
am 4 Okt. 2019
Well Adam, your encouragment (and the fact that there now is a huge banner that GUIDE will be removed) pushed me over the egde, so I now posted a thread about this. Please feel free to weigh in.
Akzeptierte Antwort
Adam Danz
am 4 Okt. 2019
Bearbeitet: Adam Danz
am 26 Dez. 2019
The problem
The "visible" property of your GUI figure was set to "off" which means the GUI was initialized properly, you just couldn't see it. As evidence, run your current version of the GUI that does not display the figure and then run this line of code which searches for figures even if they are invisible.
findall(0,'type','figure')
The solution
If you're working with Matlab r2019a or earlier, follow these steps.
- Remove any breaks in your GUI code and close the m-file.
- Open the GUI in GUIDE: guide('GUI_start')
- right-click the GUI background and select Property Inspector
- scroll down to "Visible" and check "on"
- Save the GUI in GUIDE and close the GUIDE window
- Now when you open your GUI it should be visible.
If you're working with Matlab r2019b, the problem is a bit deeper. Starting in r2019b an annotationPane handle is included in GUIDE GUIs and this handle was not present in GUIDE GUIs prior to r2019b. I brought this to the attention of the forum last week in this post. If you follow the instructions above in r2019b, you'll get an error as soon as you follow step #4 (selecting the Visible checkbox). The error is associated with the AnnotationPane class, shown below. If you're working with r2019b, instead of following the instructions above, you can just download the attachments which are your GUI files after I've completed the 6 steps above in r2019a. Alternatively, you can try the patch described in the first solution here.
[Update 26-Dec-2019]: Update #3 for r2019b fixes this problem: https://www.mathworks.com/support/bugreports/2083859
2 Kommentare
Adam Danz
am 21 Nov. 2019
In case you're working with your GUI in r2019b, I wrote a patch to try to solve the problem of accessing the GUI while avoiding the bug in the r2019b release. If you find yourself dealing with that problem, here's a solution.
Weitere Antworten (1)
Rik
am 4 Okt. 2019
Did you notice this line?
% Begin initialization code - DO NOT EDIT
They weren't kidding. It is easy to mess up GUIDE-created GUIs. I'm not seeing the closing of this comment, so something happened to that code. Somehow the code responsible to making the GUI visible isn't running. The code below should be a temporary fix to make your GUI visible again.
h=GUI_start;
set(h,'Visible','on')
2 Kommentare
Adam Danz
am 4 Okt. 2019
Visibility was indeed the issue but the user would have to run this line of code every time they access the GUI. Even if this line below were placed in the opening function, the GUI will still not stay visible as long as the visibility parameter in the figure file is set to 'off' which can only be changed through GUIDE.
handles.figure1.Visible = 'on';
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!