Borrar filtros
Borrar filtros

How to create file names in certain format?

4 visualizaciones (últimos 30 días)
Kelly Howard
Kelly Howard el 9 de En. de 2016
Comentada: Kelly Howard el 9 de En. de 2016
hi guys, i would like to ask for example there are 49 files, i would like to name the file in certain format such as 001, 002 to 049. keep it in 3 digit long?

Respuesta aceptada

Stephen23
Stephen23 el 9 de En. de 2016
You can use sprintf and specify the required length and leading zeros:
for k = 1:49
name = sprintf('myfile_%03d.txt',k)
end

Más respuestas (0)

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by