Let's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:
file1
file101
file2
etc.Which is not ideal when you want your files to go like this:
file1
file2
file101
etc.So let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers91
Suggested Problems
-
Remove the small words from a list of words.
1559 Solvers
-
given 3 sides, find area of this triangle
819 Solvers
-
Convert a numerical matrix into a cell array of strings
2384 Solvers
-
658 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
399 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!