How can I use the PUBLISH function to create a PDF document in MATLAB 7.0 (R14)?
28 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 22 Jan 2010
Modifié(e) : MathWorks Support Team
le 5 Mai 2021
I want to create a PDF document instead of HTML from my file. Is there a way to do this?
Réponse acceptée
MathWorks Support Team
le 5 Mai 2021
Modifié(e) : MathWorks Support Team
le 5 Mai 2021
As of MATLAB 7.0 (R14), you can create a PDF document by using the PUBLISH function to convert your MATLAB file to LaTeX first before converting to the PDF format. You will need proper TeX tools first. Two of the TeX tools we have used are MiKTeX and GhostScript, but other TeX tools should work as well.
To install either of these products, you can go to their respective websites:
AND
Next, use the following code to convert your file to LaTeX. In this example, we choose myfile.m to be the name of your file.
publish myfile latex
You can then create the following MATLAB function file as a wrapper to quickly convert the LaTeX file to PDF file format. Please make sure that LATEX.EXE and DVIPDFM.EXE are in your system path.
function pdf(file)
location = which(file);
d = fullfile(fileparts(which(file)),'html');
cmd = ['cd ' d ' && latex ' file '.tex && dvipdfm ' file ' && ' file '.pdf'];
system(cmd);
Then, the following line will do this conversion:
pdf myfile
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Printing and Saving dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!