how to close a guide figure but close it without deleting the output struct
i have two files one being a fig set up with the guide and one that is suposed to take the fig file and use the user inputed numbers to calculate stuff.
the fig file creates a struct of said numbers and i can get the fig to run in the other script file but when i try and call on one of those numbers entered it says its trying to call on a deleted figure
function fpok_Callback(hObject, eventdata, handles)
%guidata(hObject,handles);
clc
% fpmcstr=string(get(handles.chkfpmc,’string’))
% fpcoystr=string(get(handles.chkfpcoy,’string’))
% fprgstr=string(get(handles.chkfprg,’string’))
% fpblkstr=string(get(handles.chkfpblk,’string’))
% fpmcbstr=string(get(handles.chkfpmcb,’string’))
% fparidstr=string(get(handles.chkfparid,’string’))
%
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
if get(handles.chkfpmc,’Value’)
fpmcqt1=handles.fpmcqt.String;
fpres.fpmcqt=str2double(fpmcqt1)
end
if get(handles.chkfpcoy,’Value’)
fpcoyqt1=handles.fpcoyqt.String;
fpres.fpcoyqt=str2double(fpcoyqt1)
end
if get(handles.chkfprg,’Value’)
fprgqt1=handles.fprgqt.String;
fpres.fprgqt=str2double(fprgqt1)
end
if get(handles.chkfpblk,’Value’)
fpblkqt1=handles.fpblkqt.String;
fpres.fpblkqt=str2double(fpblkqt1)
end
if get(handles.chkfpmcb,’Value’)
fpmcbqt1=handles.fpmcbqt.String;
fpres.fpmcbqt=str2double(fpmcbqt1)
end
if get(handles.chkfparid,’Value’)
fparidqt1=handles.fparidqt.String;
fpres.fparidqt=str2double(fparidqt1)
end
handles.output=fpres;
%guidata(hObject,handles);
uiresume(ancestor(hObject, ‘figure’))
close()
%save(Flatpack, ‘fpres.FlatpackMC’)
when the ok button is puched this runs, and
fp=questdlg(‘Flatpacks’,’Select’,’Yes’,’No’,’c’);
switch fp
case ‘Yes’
fpres=Flatpack;
otherwise
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
end
if ~ishandle(Flatpack)
fpmcqt=fpres.fpmcqt;
end
this is what i have in the other script to call the fig and the numbers entered in it. ther is only fpmcqt because i have been just testing the one to see if it can work.i have two files one being a fig set up with the guide and one that is suposed to take the fig file and use the user inputed numbers to calculate stuff.
the fig file creates a struct of said numbers and i can get the fig to run in the other script file but when i try and call on one of those numbers entered it says its trying to call on a deleted figure
function fpok_Callback(hObject, eventdata, handles)
%guidata(hObject,handles);
clc
% fpmcstr=string(get(handles.chkfpmc,’string’))
% fpcoystr=string(get(handles.chkfpcoy,’string’))
% fprgstr=string(get(handles.chkfprg,’string’))
% fpblkstr=string(get(handles.chkfpblk,’string’))
% fpmcbstr=string(get(handles.chkfpmcb,’string’))
% fparidstr=string(get(handles.chkfparid,’string’))
%
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
if get(handles.chkfpmc,’Value’)
fpmcqt1=handles.fpmcqt.String;
fpres.fpmcqt=str2double(fpmcqt1)
end
if get(handles.chkfpcoy,’Value’)
fpcoyqt1=handles.fpcoyqt.String;
fpres.fpcoyqt=str2double(fpcoyqt1)
end
if get(handles.chkfprg,’Value’)
fprgqt1=handles.fprgqt.String;
fpres.fprgqt=str2double(fprgqt1)
end
if get(handles.chkfpblk,’Value’)
fpblkqt1=handles.fpblkqt.String;
fpres.fpblkqt=str2double(fpblkqt1)
end
if get(handles.chkfpmcb,’Value’)
fpmcbqt1=handles.fpmcbqt.String;
fpres.fpmcbqt=str2double(fpmcbqt1)
end
if get(handles.chkfparid,’Value’)
fparidqt1=handles.fparidqt.String;
fpres.fparidqt=str2double(fparidqt1)
end
handles.output=fpres;
%guidata(hObject,handles);
uiresume(ancestor(hObject, ‘figure’))
close()
%save(Flatpack, ‘fpres.FlatpackMC’)
when the ok button is puched this runs, and
fp=questdlg(‘Flatpacks’,’Select’,’Yes’,’No’,’c’);
switch fp
case ‘Yes’
fpres=Flatpack;
otherwise
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
end
if ~ishandle(Flatpack)
fpmcqt=fpres.fpmcqt;
end
this is what i have in the other script to call the fig and the numbers entered in it. ther is only fpmcqt because i have been just testing the one to see if it can work. i have two files one being a fig set up with the guide and one that is suposed to take the fig file and use the user inputed numbers to calculate stuff.
the fig file creates a struct of said numbers and i can get the fig to run in the other script file but when i try and call on one of those numbers entered it says its trying to call on a deleted figure
function fpok_Callback(hObject, eventdata, handles)
%guidata(hObject,handles);
clc
% fpmcstr=string(get(handles.chkfpmc,’string’))
% fpcoystr=string(get(handles.chkfpcoy,’string’))
% fprgstr=string(get(handles.chkfprg,’string’))
% fpblkstr=string(get(handles.chkfpblk,’string’))
% fpmcbstr=string(get(handles.chkfpmcb,’string’))
% fparidstr=string(get(handles.chkfparid,’string’))
%
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
if get(handles.chkfpmc,’Value’)
fpmcqt1=handles.fpmcqt.String;
fpres.fpmcqt=str2double(fpmcqt1)
end
if get(handles.chkfpcoy,’Value’)
fpcoyqt1=handles.fpcoyqt.String;
fpres.fpcoyqt=str2double(fpcoyqt1)
end
if get(handles.chkfprg,’Value’)
fprgqt1=handles.fprgqt.String;
fpres.fprgqt=str2double(fprgqt1)
end
if get(handles.chkfpblk,’Value’)
fpblkqt1=handles.fpblkqt.String;
fpres.fpblkqt=str2double(fpblkqt1)
end
if get(handles.chkfpmcb,’Value’)
fpmcbqt1=handles.fpmcbqt.String;
fpres.fpmcbqt=str2double(fpmcbqt1)
end
if get(handles.chkfparid,’Value’)
fparidqt1=handles.fparidqt.String;
fpres.fparidqt=str2double(fparidqt1)
end
handles.output=fpres;
%guidata(hObject,handles);
uiresume(ancestor(hObject, ‘figure’))
close()
%save(Flatpack, ‘fpres.FlatpackMC’)
when the ok button is puched this runs, and
fp=questdlg(‘Flatpacks’,’Select’,’Yes’,’No’,’c’);
switch fp
case ‘Yes’
fpres=Flatpack;
otherwise
fpres=struct(‘fpmcqt’,0,’fpcoyqt’,0,’fprgqt’,0,’fpblkqt’,0,’fpmcbqt’,0,’fparidqt’,0);
end
if ~ishandle(Flatpack)
fpmcqt=fpres.fpmcqt;
end
this is what i have in the other script to call the fig and the numbers entered in it. ther is only fpmcqt because i have been just testing the one to see if it can work. guide, matlab, gui, figure MATLAB Answers — New Questions