Print PDF from Matlab

Saving PDF of plots from Matlab is an effective way to use Matlab plots in LaTeX or for general sharing of high quality plots. Matlab exportgraphics, helps create production-ready plots from Matlab. We also recommend tiledlayout for creating subplots. Use “exportgraphics” instead of the “print” and “saveas” functions, which are generally not recommended for saving plots.

Example:

fg = figure;
ax = axes(parent=fg);
plot(ax, 1:10)

exportgraphics(fg, 'line.pdf', Resolution=300)