Modifying sequential filenames with padded numbers
50 views (last 30 days)
Show older comments
Hello, I am trying to create some file names to save a setr of images and have so far done this:
>> filenames = "clock_" + string(1:8) + ".jpg";
>> filenames'
ans =
8×1 string array
"clock_1.jpg"
"clock_2.jpg"
"clock_3.jpg"
"clock_4.jpg"
"clock_5.jpg"
"clock_6.jpg"
"clock_7.jpg"
"clock_8.jpg"
I'd like to improve on this and have the numers like this:
"clock_001.jpg"
"clock_002.jpg"
"clock_003.jpg"
and to be able to change the starting value. For example, start at 11 would be:
"clock_011.jpg"
"clock_012.jpg"
"clock_013.jpg"
and as a last request I'd like to prefix the current datetime using now()
Thanks
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!