How do I convert MATLAB file to PDF file?

2,147 ビュー (過去 30 日間)
BEYZA NUR ULUOGLU
BEYZA NUR ULUOGLU 2020 年 3 月 29 日
編集済み: Cris LaPierre 2025 年 2 月 10 日
I write code in MATLAB. Now, I want to convert PDF, DOC or DOCX. How can I do this?
  4 件のコメント
Colin
Colin 2025 年 2 月 10 日
What a nightmare. A person wants to print a script file as pdf -- no fancy headers, table of contents, bold comments, figures. MathWorks can't even explain how to do that!
Cris LaPierre
Cris LaPierre 2025 年 2 月 10 日
編集済み: Cris LaPierre 2025 年 2 月 10 日
There are 2 options described below. Not sure why those options don't work for you, but if you just want to print to pdf, click the print icon in the EDITOR tab ('Live Editor' tab if working with mlx file). The appearance may depend on your version of MATLAB, and whether it is an *.mlx or *.m file.
You'll get a print dialog where you can set your printer to be a PDF printer.
If you are using the New Desktop, you'll get a dialog with a Print to PDF button on it.

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2024 年 10 月 21 日
編集済み: MathWorks Support Team 2024 年 10 月 21 日
To convert a live script to PDF, go to the Live Editor tab and select Export > Export to PDF. For more information, see Ways to Share and Export Live Scripts and Functions. Alternatively, you can use the "export" function.  
For example: 
export("myfile.mlx")
To convert a script to PDF, on the Publish tab, select Publish > Edit Publishing Options. Then, set the Output file format to pdf. For more information, see Publish and Share MATLAB Code. Alternatively, you can use the "publish" function.  
For example:  
publish("myfile.m","pdf");
  3 件のコメント
Arujan Rajadurai
Arujan Rajadurai 2020 年 10 月 10 日
How about if I'm just using a script (not live), is there a way to print my script as a pdf?
Thank you!
Cris LaPierre
Cris LaPierre 2020 年 10 月 10 日
編集済み: Cris LaPierre 2020 年 10 月 10 日
Use the publish function.
publish('script.m','pdf')
You should also see a Publish tab when viewing a *.m script in the editor. Follow these steps to use a graphical approach.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScripts についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by