MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question about filenames for Export[...]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99762] Re: Question about filenames for Export[...]
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Wed, 13 May 2009 05:09:34 -0400 (EDT)
  • References: <gubgej$9v0$1@smc.vnet.net>

Hi,

> 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 like:
> 
> character(len) :: FileName
> ...
> write(FileName,'(A,I4.4)') 'MyName', i
> 
> These lines would produce filenames which, for i=1,2,... are MyName0001, 
> MyName0002, ...
> 
> Is there any neat way of doing the same with Mathematica?
> 
StringJoin["MyName",ToString[i]]

or short:

"MyName"<>ToString[i]

depending on how many indices you need, maybe something like this is
more convenient:

ToString[StringForm["MyName`1`-`2`-`3`-`4`",i,j,k,l]]

hth,

albert


  • Prev by Date: barchart labeling
  • Next by Date: Re: Question about filenames for Export[...]
  • Previous by thread: Question about filenames for Export[...]
  • Next by thread: Re: Question about filenames for Export[...]