How to redraw the current saved histogram "fig" file

2 次查看(过去 30 天)
Hello,
I currently have the saved "fig" file generated by Matlab by using the default histogram "bin" size as I do not know what the histogram plot output would be.
For example:
Histogram_Plot=histogram(Histogram_Inputt_Plot_data);
savefig('Histogram_Plot.fig')
Since I got the saved "Histogram_Plot.fig" file, now I want to redraw the histogram using different bin. How can I extract the data or manupulate from the existing saved fig file and redraw with different bin size now that I got the data from the saved fig file. The reason I want to do this because I do not want to rerun the simulation again and I want use the data I already got from the saved fig file.
Thanks,
Charles

回答(1 个)

Kevin Rawson
Kevin Rawson 2019-4-14
Provided only the histogram is in the figure, the following should work:
hFig = open('Histogram_Plot.fig');
hAxes = hFig.Children;
hHist = hAxes.Children;
hHist.BinEdges = [ <your new bins here> ];
If you have additional lines in the figure (i.e. the figure axes have multiple children), you'll have to ensure you get the correct handle of your histogram.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by