Projects & Tools‎ > ‎

MATLAB export image to a .pdf file

Create a .pdf file with multiple exported MATLAB figures might be an interesting function. This project has advanced a tentative way to export multiple MATLAB figures to a single .pdf file.
There are three main steps for accomplishing this task: 
(1) Download the Ghostscript software and the ps2pdf.m file and install the Ghostscript.
(2) Export the MATLAB figures to a .ps file using the following syntax:
     if(i==1)
        print('-dpsc','LUSpatialAttributes.ps',h);     
    else
        print('-dpsc','LUSpatialAttributes.ps','-append',h);     % if the exported figure is not the first one, append it to avoid overwritting  
    end
(3) Convert the .ps file to .pdf file using ps2pdf. Syntax as: "ps2pdf('psfile','LUSpatialAttributes.ps','pdffile','LUSpatial_attributes.pdf');"
Finish!
 
Attached you can find the demo data and code. Enjoy and always be grateful to the programmer of Ghostscript and ps2pdf.m! (^_^)
Ĉ
鲁振宇,
Feb 16, 2011, 5:48 PM
ċ
BoxPlot_batch.m
(5k)
鲁振宇,
Feb 16, 2011, 5:43 PM
Comments