How to Save MATLAB Code as a PDF

A brilliant and easy to use programming platform, MATLAB allows scientists, engineers, and other mathematics professionals to effortlessly express computational maths. However, the program naturally exports any written code in the form of its native code file, which might not be the best option when it comes to sharing files with different people, especially if they don’t already use MATLAB. In that case, sending a PDF file might be the smartest choice.

But can you actually save your MATLAB code in the form of a PDF? Here is a quick guide that might help:

Saving MATLAB files as PDFs

While MATLAB doesn’t actually allow you to ‘save’ a file as a PDF, following the same process as you would in some other platforms, you do have the opportunity to export code as a PDF using the ‘Publish’ feature. Here’s how:

  1. If you haven’t already, open the file you’d like to save as a PDF in MATLAB.
  2. Press the down arrow that’s located right next to the Publish icon (tilted sheet of paper) in the toolbar at the top. Here, select the ‘Edit Publish Configurations’ option.
  3. In the new window that pops up, locate the ‘Output File Format’ section. Here, click on the current extension (usually HTML) to open a drop-down menu.
  4. From the menu, simply select the PDF option.
  5. Then, click on the Publish button to view your code as a PDF file.
  6. Finally, go to Save or Print as you normally would.

And that’s it! Although it requires a couple of additional steps, you can effortlessly save your MATLAB codes as PDF files, just by following the handy guide above.