Can I put an fprint statement in a saveas command?

3 visualizaciones (últimos 30 días)
Tanner Saussaman
Tanner Saussaman el 17 de Jun. de 2021
Respondida: Jan el 18 de Jun. de 2021
So I have about 15 different sets of data that all have to go through the same exact code and spit out roughly 40 figures. I need to save these figures as fig files and jpgs. Each figure has the same begining filename except at the end where the name deviates to explain which data set it comes from. What I want to do is assign this last part of the name to a variable and call that variable in the saveas command so I don't need to go through hundreds of lines of saveas commands and manually enter in the last part of the filename. I tried to use an fprint statement and it just displays "fprint(variable)" in the filename.

Respuestas (1)

Jan
Jan el 18 de Jun. de 2021
folder = 'D:\Your\Output';
n = 4;
saveas(FigH, fullfile(folder, sprintf('File%03d.eps', n)));
This creates the file: D:\Your\Output\File004.eps

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by