GUI stops after initialization code
Mostra commenti meno recenti
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 Commenti
Adam Danz
il 4 Ott 2019
I'd bet that an error message is generated when the GUI stops initializing and I'd bet there was an error message when you were compiling the GUI after adding the problematic pushbutton.
Such problems occur when saving updates in GUIDE while the m-file contains breaks. If this sounds like what you're dealing with, attach the fig and m file and I can take a look at it. I've fixed this problem before but I haven't memorized the steps.
Rik
il 4 Ott 2019
What code do you expect to be running as well? Have the callbacks been changed?
Also note that GUIDE is probably not the best tool for anything that is slightly more complex than two buttons and an axes.
Laura F
il 4 Ott 2019
Adam Danz
il 4 Ott 2019
I quickly glanced at the initialization code, opening function, and output function and there are no obvious red flags. Unfortunately we can't run the GUI without the figure file so if you attach the m file and the fig file, we can open the hood and check the engine.
Laura F
il 4 Ott 2019
Adam Danz
il 4 Ott 2019
BTW, I second Rik's persistence in minimizing the use of GUIDE. I think drag-n-drop construction of GUIs is a useful tool, especially for beginners, but it comes with limitations and, in the case of GUIDE, bugs, if not used properly. Unlike drag-n-drop methods, building a GUI from the bottom-up by using uicontrol() or the uifigure version, requires more time during development but may save time in the long run by avoiding problems that are difficult to trace. It also gives you more control and background knowledge of object properties and such.
Laura F
il 4 Ott 2019
Adam Danz
il 4 Ott 2019
I've got a solution that I'll describe in an answer below. The solution is easy but I'm going to take a short bit of time to explain the problem so bear with me.... check back in a few minutes.
Laura F
il 4 Ott 2019
Rik
il 4 Ott 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.
Risposta accettata
Più risposte (1)
Rik
il 4 Ott 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 Commenti
Laura F
il 4 Ott 2019
Adam Danz
il 4 Ott 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';
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
