GUI closing automatically?

Hi I've got a problem again. I've got a face detection algorithm. When I try to implement in GUI. After selecting the first button, the corresponding operation takes place but this closes the GUI! Where should the problem probably be? Any guesses? And how can I avoid this??

 Risposta accettata

Jiro Doke
Jiro Doke il 22 Feb 2011

2 voti

I would assume you have a close, closereq, or delete somewhere in your code. Put a breakpoint on the first line of your button callback, and step through one line at a time, and you should be able to discover the problem

6 Commenti

Niranjan
Niranjan il 23 Feb 2011
No Doke, I am very sure I never used close in my coding. However when I tried the same code in a different GUI, it didn't give me any error. Confused!
Jiro Doke
Jiro Doke il 23 Feb 2011
Did you do what I suggested: put a breakpoint and step through your code line by line until the figure closes?
Jan
Jan il 23 Feb 2011
@Niranjan: Beeing "very sure" does not help when programming in Matlab. Matlab is certain, that you are using CLOSE or DELETE with the handle of the dialog. I definitely trust Jiro's estimation.
Niranjan
Niranjan il 25 Feb 2011
I am sorry guys , Jiro was rite . It is my habit to use clc;clear all;close all; at the starting of the code. That's what caused me the problem. When I removed it ,things were back to normal.
Jan
Jan il 25 Feb 2011
Another strong hint that "clc;clear all; close all" is not useful but more likely causes trouble.
Very helpful

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by