Re: Question about filenames for Export[...]
- To: mathgroup at smc.vnet.net
- Subject: [mg99787] Re: Question about filenames for Export[...]
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Thu, 14 May 2009 01:42:59 -0400 (EDT)
- References: <gubgej$9v0$1@smc.vnet.net> <gue2im$7k3$1@smc.vnet.net>
Nice, IntegerString had crossed the border below my radar. Cheers -- Sjoerd On May 13, 11:06 am, Bob F <deepyog... at gmail.com> wrote: > On May 12, 3:44 am, "Lorents" <f... at ff.gr> wrote: > > > > > Hello, > > I'm using Mathematica 6. > > I'd like to know how to define a file name (to be later used in Export)= so > > that the file name contains the value of an index variable i. > > To exemplify, in Fortran this task would be accomplished by something l= ike: > > > character(len) :: FileName > > ... > > write(FileName,'(A,I4.4)') 'MyName', i > > > These lines would produce filenames which, for i=1,2,... are MyName00= 01, > > MyName0002, ... > > > Is there any neat way of doing the same with Mathematica? > > > Lorenzo > > Wonder how many different solutions this question will generate? > > One way is to use IntegerString and StringJoin in something like: > > i = 1; > filename = StringJoin["MyName", IntegerString[i, 10, 4]] > > HTH... > > -Bob