different file name in saving images

2 visualizaciones (últimos 30 días)
Turbulence Analysis
Turbulence Analysis el 27 de Abr. de 2022
Comentada: Turbulence Analysis el 27 de Abr. de 2022
In the below script, based on iteration numbers in for loop, I need to change Y_10, Y_20,Y_30,Y_40.....Y_100
Is there a way to achive this instead of renaming everytime ??
saveas(gcf, sprintf('Y_10mm'), 'bmp')
savefig(gcf, sprintf('Y_10mm')

Respuesta aceptada

DGM
DGM el 27 de Abr. de 2022
Editada: DGM el 27 de Abr. de 2022
In whatever loop you're using, create the filename something like this:
k = 10 % whatever number you need
k = 10
sprintf('Y_%03dmm.bmp',k)
ans = 'Y_010mm.bmp'
Unless you have a need to avoid it, zero-pad your numbers so that your files sort correctly and are easier to read back in corresponding order
  4 comentarios
Turbulence Analysis
Turbulence Analysis el 27 de Abr. de 2022
Got it!! Thank you very much..

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings 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