Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Filenames
Replies: 1   Last Post: Aug 5, 2014 3:11 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Curious

Posts: 1,986
Registered: 12/6/04
Re: Filenames
Posted: Aug 5, 2014 3:11 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Will " <owill127@gmail.com> wrote in message <lrr5rr$cl4$1@newscl01ah.mathworks.com>...
> I am trying to use matlab to analyze some data and export it to excel. My data is in files with identical names except the ending is a number. for example
>
> text_#1.txt
>
> There are sometimes thousands of these files. My problem is that matlab processes them in this order
> 100
> 10
> 1
> 12
> 13
> etc
>
> There are far too many files to change manually so I would like to change the files to all the same number of digits using matlab. for example:
>
> text_#1.txt would change to text_#001.txt
>
> anyone know how to do it?
>
> Thanks


Look here:

<<http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F>>

and modify the example using the '0' flag in sprintf shown here:

<<http://www.mathworks.com/help/matlab/ref/sprintf.html#inputarg_formatSpec>>

to zero pad the field width.


Date Subject Author
8/5/14
Read Filenames
Will
8/5/14
Read Re: Filenames
Curious

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.