Save as png

Save figure as png or pdf

save plot as png with 300 dpi resolution

print('figure01', '-dpng', '-r300')

save plot as pdf

print('figure02', '-dpdf')

https://www.mathworks.com/help/matlab/ref/print.html