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: [mg99788] Re: Question about filenames for Export[...]
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 14 May 2009 01:43:10 -0400 (EDT)
  • References: <gubgej$9v0$1@smc.vnet.net> <gue2nd$7p5$1@smc.vnet.net>

The extra 0 is because of the position for the invisible plus sign in
positive numbers. Use NumberSigns -> {"", ""} if you want to remove
them.

Cheers -- Sjoerd

On May 13, 11:09 am, Szabolcs Horv=E1t <szhor... at gmail.com> wrote:
> Lorents 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, ...
>
> I'd also like to know if there is a "neat" way to achieve this.  The wa=
y
> I've been using was not that pretty ...
>
> makeFileName[i_Integer] :=
>   "prefix" <> ToString@PaddedForm[i, 4, NumberPadding -> "0"]
>
> What I hate about this is that it adds an extra zero ...  See what
> makeFileName[12345] outputs.
>
> Another way is
>
> makeFileName2[i_] := "prefix" <> ToString /@ IntegerDigits[i, 10, 5]
>
> But do we really need to do so much work---breaking the number into
> digits---for something so simple?



  • Prev by Date: Re: GuiKit, seeking some guidance and comments
  • Next by Date: Re: Introducing the Wolfram Mathematica Tutorial
  • Previous by thread: Re: Question about filenames for Export[...]
  • Next by thread: Re: Question about filenames for Export[...]