MATLAB: Closing a specified figure (if exist)

closingfigurespecified

does anyone know how to close a specified figure if it exists currently? for example: h=figure
if h exists close(h) end

Best Answer

h = figure;
if ishandle(h)
close(h)
end