I have pre-allocated my figures such that I generate an empty figure window without a plot which is assigned to a figure handle at the start of a script. I then close these figures as I don't require they all be opened or remain open all at once. I want to reopen these figures one by one at appropriate times, but it appears that upon closing a figure by its assigned/allocated handle within Matlab 2014b and onwards, the assigned figure handle empties itself of all information related to the figure. I understand that the nature of the figure handle has changed to an object now and I need to utilise the figure.Number property to access it's assigned integer.
h = figure; % Pre-allocate figure handle. Generates figure object in Matlab 2014b and onwards.close(h); % Close pre-allocated figure.figure(h.Number); % Re-open figure.
This produces the following error.
Invalid or deleted object.
How do I reopen a closed figure in Matlab 2014b and onwards?