MATLAB: Close a specific figure file

close a specific figure file

i display a table in a figure file…
now i want to close this file,
i did
close 'ANALYSIS'
and it worked, but if it does not exists it shows error that file does not exists…
how to check if a figure of ANALYSIS name exists
if exist('ANALYSIS', 'file')
close 'ANALYSIS'
end
this is not working for me… please do reply…

Best Answer

You can use try function
try
close('ANALYSIS')
end
%Or you can use
ob=findobj('type','figure','name','ANALYSIS')
close(ob)