You cannot access to a deleted figure, so how about saving it as a fig file first?
start 1st button push callback
[orig_fig1]=my_func(data);
app.figurestorage=orig_fig1;
figure(app.figurestorage)
savefig('myFig.fig')
end 1st button push callback
start 2nd button push callback
end 2nd button push callback
UPDATED
Here is a way without creating any file.
start 1st button push callback
[orig_fig1]=my_func(data);
app.figurestorage=orig_fig1;
figure(app.figurestorage)
set(app.figurestorage, 'CloseRequestFcn', {@myCloseFcn, app});
function myCloseFcn(src, eve, app)
app.figurestorage.Visible = 'off';
end
end 1st button push callback
start 2nd button push callback
figure(app.figurestorage)
end 2nd button push callback
Best Answer