Problem closing a window (GUI)

10 visualizzazioni (ultimi 30 giorni)
Jaime
Jaime il 5 Mar 2013
Commentato: Juan Arteaga il 8 Set 2020
Hello everybody, i will explain very fast my problem:
I have the initial window called: "inicio" in my program and i created a button called: "continuar". Then i edited the callback as follows:
function continuar_Callback(hObject, eventdata, handles)
% hObject handle to continuar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close inicio
velocidades
With the objective to close inicio and open the new window: velocidades.
the problem is that matlab give me this error:
??? Error using ==> close Specified window does not exist.
Error in ==> inicio>continuar_Callback at 88 close inicio
Error in ==> gui_mainfcn at 75 feval(varargin{:});
Error in ==> inicio at 44 gui_mainfcn(gui_State, varargin{:});
??? Error while evaluating uicontrol Callback.
Probably is a simple error but i have been crazy looking for the problem or trying differents names and i can´t find it. Them name of the initial window file is: inicio.m and inicio.fig (i dont know if i should modify tag or name...)
thanks you very much

Risposta accettata

Jan
Jan il 6 Mar 2013
Modificato: Jan il 6 Mar 2013
When you have a problem with a command, read its documentation at first. There you find, that close() required the handle of the figure or the "name":
"close name" deletes the figure with the specified name.
But what exactly is "the name"? Is this the 'Name' property? Does the 'NumberTitle' property matter? What about the title, when the name is empty?
I'd prefer to obtain the figure handle explicitly. Is it stored in the handles struct? Is it a parent of the currently called object? Does the figure have a unique tag or 'name' property? Is it possible that multiple instances of the GUI are opened, such that searchung for a tag or name may fail?
  3 Commenti
Christopher Elliott
Christopher Elliott il 17 Giu 2019
close ALL FORCE
solved the issue for me in R2016B.
Juan Arteaga
Juan Arteaga il 8 Set 2020
Thank you Christopher Elliott, your command also worked for me

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by