% small utility to have persistent figures, indicized by name function handle = named_figure(figure_name) global smart_figure_map__; if ~isequal(class(smart_figure_map__), 'containers.Map') smart_figure_map__ = containers.Map; end create = true; if smart_figure_map__.isKey(figure_name) handle = smart_figure_map__(figure_name); % handle possibly deleted figures if isvalid(handle) create = false; end end if create handle = figure('Name', figure_name); smart_figure_map__(figure_name) = handle; end figure(handle); end