Creating a graph with overlapping histograms and saving it to a single file

view full story

http://stackoverflow.com – I am trying to write a Matlab script to analyze two specific sets of data, create histograms for them, and write them to a single file where you can see both histograms overlapped on one plot. I created a functioning script that created the histogram for 1 set of data that basically went like this: h1=figure; hist(data,nbins:; print(h1,'-dpng','hist.png) Then I tried to simply add a second line of: h2=figure; and changed the print function to include h2. That obviously didn't work. I found that I couldn't have both an h1 and an h2 with the print function. After searching the internet (HowTos)