how to separate file name and put the number at the end to count files
Show older comments
I want to write a script for counting files. For example, my file name is "transport 052412_#1 3D gfp_z000_ch00.tif". I want to do 2 things. Firstly, I want to separate this name into base_name,transport 052412, and,varied_name,#1 3D gfp_z000_ch00. Then, I want to put the number at the of the file name to count such as 001, 002, and so on.
From this objective, I used fileparts [pathstr,name,ext,versn] = fileparts('filename') to separate the name of the file but it didn't work. So could you give me some advice for this.
Thanks, Nopparat
3 Comments
Walter Roberson
on 28 Aug 2012
Is the rule to separate it at the "#" ?
Nopparat
on 29 Aug 2012
Walter Roberson
on 29 Aug 2012
Then is the rule that the underscore is the separator?
In order to separate the name, we need rules about where the name part stops.
Accepted Answer
More Answers (0)
Categories
Find more on Manage Products 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!