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: [mg99750] Re: Question about filenames for Export[...]
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 13 May 2009 05:07:22 -0400 (EDT)
  • References: <gubgej$9v0$1@smc.vnet.net>

Hi Lorentzo,

Here are some possibilities; replace 27 with your number or variable.

"MyName" <> StringDrop[ToString[10000 + #], 1] & @ 27

StringReplacePart["MyName0000", #, {-StringLength[#], -1}] &@
 ToString@27

"MyName" <>
 ToString[PaddedForm[27, 4, NumberPadding -> "0",
   NumberSigns -> {"", ""}]]

"MyName" <> ToString[PaddedForm[27, 3, NumberPadding -> "0"]]

Cheers -- Sjoerd


On May 12, 11: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) s=
o
> that the file name contains the value of an index variable i.
> To exemplify, in Fortran this task would be accomplished by something lik=
e:
>
> 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?
>
> Lorenzo



  • Prev by Date: Assign new values to matrix using indices
  • Next by Date: Re: Question about filenames for Export[...]
  • Previous by thread: Re: Question about filenames for Export[...]
  • Next by thread: Re: Question about filenames for Export[...]