Publishing options: low image quality, no options to export as vector graphics

10 Ansichten (letzte 30 Tage)
I want to publish my matlab code and its graphical output with annotations for reporting/documentation purposes.
As the live scripts are not suited for source control in git (or are they?), I use plain .m files and the publishing markup (https://de.mathworks.com/help/matlab/matlab_prog/marking-up-matlab-comments-for-publishing.html).
Yet in the publishing options (under publish/edit configurations), I can only choose png/jpeg/bmp/tiff, and the image resolution is low. Is there an option to generate pdf or html files with vector graphics instead of pixelated graphics?

Akzeptierte Antwort

Richard Quist
Richard Quist am 6 Mai 2022
I don't think there's a way to get true-vector output with the publish command, or to increase the resolution/DPI of the figure images it captures.
Have you tried using any of the "Export to..." options provided by the Live Editor? I believe they generate higher quality output for figures. Also, in R2022a, a new export function was added to allow programmatic exporting of .mlx files to several formats, such as PDF, Microsoft Word and HTML.
% Example of saving an MLX file to PDF
% using the new export function introduced in R2022a
export("myscript.mlx"); % exports to myscript.pdf
export("myscript.mlx", "output.pdf"); % export to output.pdf
I hope that helps.
  1 Kommentar
Rene Burger
Rene Burger am 16 Mai 2022
Bearbeitet: Rene Burger am 16 Mai 2022
Thank you for your Answer!
It's sad that MATLABs publishing options are so restricted. The figure resolution in the export via the live editor is also not better by default.
As a workaround, I now do the following:
  1. Save the source controllable .m file temporarily as .mlx
  2. Set the export figure resolution for pdf exports in .mlx scripts using the code below
  3. Export as pdf
s = settings;
s.matlab.editor.export.FigureResolution.TemporaryValue = 600;
In mlx pdf export the formatting looks nice and the resolution now is good. Yet there is no automatic line breaking with very long code lines, so one has to keep that in mind...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by