I understand you want to export a PDF file from an .mlx file without interrupting on an error in between. The default behaviour of an .mlx file is to stop code exceution as soon as an error is encountered. However, there are 2 possible options to generate PDF even if the code has errors:
- Separate code into sections and run manually: You can move the code with errors into separate sections and then run each section manually. This ensures that the error is logged in side panel for each faulty section and rest of the code works fine with output shown correctly. Following that, export command can be used to generate a PDF since this command does not re-run the code.
- Use try/catch block: You many also use try/catch blocks to add the faulty code into try block and use the catch block to display the error message. This ensures code keeps running even if there are any errors.
Please find more details regarding export command in this documentation: https://www.mathworks.com/help/matlab/ref/export.html
I hope this helps achieve the desired functionality!