'Saving multiple figures all at once
I need to save all the figures that generated from one set of MATLAB code into one single pdf file instead having them in separate files.
X = rand(20,1);
Y = rand(20,1);
t=(1:20)';
figure(1);
plot(t,X);
saveas(gcf,'figure1.pdf');
figure(2);
plot(t,Y);
saveas(gcf,'figure2.pdf');
Solution 1:[1]
If this question turned up in your search result, MATLAB version newer than R2020a can save multiple figures in one PDF file with the following command and switch:
exportgraphics(ax,'myplots.pdf','Append',true)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | X Zhang |
