Today, I'd like to highlight an entry that I mentioned during one of the customer trainings I gave a few months ago. It's from one of our regular MATLAB Central (and MATLAB) user, Oliver, whom many of you may know.
In the training, we were talking about exporting figures to various formats, and one of the attendees wanted to export them as multi-page PDFs. The print function has an option for exporting a figure as a single-page PDF. It also has an option for exporting multi-page PostScript files. So all you need to do is convert the multi-page PostScript file to a PDF. The initial solution I provided was to use an external program, like Ghostscript, to do the conversion. This is actually how I've always done this back when I was in grad school.
Just having learned about "automation" in the training, the attendee wanted to automate this process in MATLAB. I'm sure it's possible, I thought, but I went straight to the File Exchange. There were actually a few entries that looked promising. The one that met my needs was Oliver's. You still do need to install Ghostscript separately, but once you do that, the tool seemed to automatically find it and use it to combine multiple PDFs.
% Create 3 figures and save them individually to PDFs figure peaks print -dpdf fig1.pdf figure spy print -dpdf fig2.pdf figure plot(rand(10,3)) print -dpdf fig3.pdf % Combine three PDFs into one append_pdfs allfigs.pdf fig1.pdf fig2.pdf fig3.pdf
As I mentioned in the beginning, this functionality is rolled into the ever-so-popular export_fig, for which Oliver was the original author. Oliver mentions that the one in export_fig is the maintained version, so I suggest downloading export_fig.
I do want to put a plug in for Multiple Page PDF by James Herman and ps2pdf by Richard Quist. They both use ghostscript that comes with MATLAB, so you don't need to install anything additional. In R2015b, MATLAB changed how PDFs are generated, so these entries don't work any more, but if you're using an older release of MATLAB, definitely take a look.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.