How do I convert MATLAB file to PDF file?

2,275 views (last 30 days)
I write code in MATLAB. Now, I want to convert PDF, DOC or DOCX. How can I do this?
  2 Comments
MIN
MIN on 28 Oct 2023
Moved: Rik on 29 Oct 2023
I don't want to include picture....how can I do that?

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 21 Oct 2024
Edited: MathWorks Support Team on 21 Oct 2024
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 Comments
Arujan Rajadurai
Arujan Rajadurai on 10 Oct 2020
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 on 10 Oct 2020
Edited: Cris LaPierre on 10 Oct 2020
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Live Scripts and Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!