How to create file names in certain format?

4 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by