Code for pushbutton in gui to close the .fig.
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen

I have a pushbutton in my .fig, shown above. The main purpose of this pushbutton is to close the .fig file. Can anyone help me what code to add in the callback function or createfcn, that after the button is pushed, the .fig file will close. Thanks.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function pushbutton1_CreateFcn(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
0 Kommentare
Antworten (1)
Walter Roberson
am 30 Aug. 2019
.fig files do not stay open if you use load() or uiimport() or openfig()
A .fig file would only stay open if you use fopen()
If you have have done an openfig then the .fig is automatically closed. What is left open is a figure object. You can close() or delete() figure objects. If you use close() then you can even close by figure Name property.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects 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!