savefigures with filenames from a cell array

1 visualización (últimos 30 días)
Turbulence Analysis
Turbulence Analysis el 22 de Dic. de 2022
Comentada: Turbulence Analysis el 22 de Dic. de 2022
I intend to save the figures with the names that being defined in the cell array
for e.g. as shown in the below code, the final name should be A_X_3_Y_5.bmp
vars = {'A','B','C','D','E','F'};
f=3;
g=5;
saveas(gcf, sprintf('(vars{1})_X_%3d_Y_%3d.bmp',f,g))

Respuesta aceptada

Stephen23
Stephen23 el 22 de Dic. de 2022
Editada: Stephen23 el 22 de Dic. de 2022
You are already calling SPRINTF() to generate the filename, so just provide it with the text input too:
vars = {'A','B','C','D','E','F'};
f = 3;
g = 5;
fnm = sprintf('%s_X_%d_Y_%d.bmp',vars{1},f,g)
fnm = 'A_X_3_Y_5.bmp'
saveas(gcf,fnm)
Read the SPRINTF documentation to know more:
  1 comentario
Turbulence Analysis
Turbulence Analysis el 22 de Dic. de 2022
Thank you very much, Stephen!!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Display Image en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by