MATLAB: Overwrite an existing GUI

overwrite an existing gui

good night everybody, is there anyone that knows anyfunction to count number of opened graphs because in my GUI, in the 1st interfaace I have a pusbutton and it is generating variables on another interface depends on the values entered by the user. When user wants to generate any other variables I want to overwrite the existing one so I guess it maybe possible to know the amount of figures and close all except 1st one, or how can I overwrite an existing table, I could not check the handle of table because handle is erased just after creation or not exist before execution for any suggestion thanks in advance good weekends

Best Answer

figurehandles = findall(0, '-type', 'figure');
number_of_figures_open = length(figurehandles);