%% Saving and Loading Histogram Objects
% Use the savefig function to save a histogram figure.

y = histogram(randn(10));
savefig('histogram.fig');
clear all
close all

%
% Use openfig to load the histogram figure back into MATLAB. openfig also returns a handle to the figure, h.

h = openfig('histogram.fig');

%
% Use the findobj function to locate the correct object handle from the figure handle. This allows you to continue manipulating the original histogram object used to generate the figure.

y = findobj(h, 'type', 'histogram')

% Copyright 2015 The MathWorks, Inc.