Skip to content

Instantly share code, notes, and snippets.

@liborw
Created March 29, 2013 07:19
Show Gist options
  • Select an option

  • Save liborw/5269266 to your computer and use it in GitHub Desktop.

Select an option

Save liborw/5269266 to your computer and use it in GitHub Desktop.
function namedfig(name)
%NAMEDFIG Create or select named figure.
% Libor Wagner on March 25, 2013
persistent figs
% Reset if requested
if nargin<1 | isempty(name)
figs = [];
return
end
% Initilaize figs map
if isempty(figs)
figs = containers.Map;
end
% Select or crate named figure
if isKey(figs, name)
h = figs(name);
figure(h);
% Set window name
set(h,'Name',name,'NumberTitle','off');
else
h = figure();
figs(name) = h;
% Set window name
set(h,'Name',name,'NumberTitle','off');
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment