Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Generating a list numnber in string format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102611] Re: [mg102598] Generating a list numnber in string format
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 17 Aug 2009 04:01:12 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

ToExpression[Table["bin" <> ToString[n], {n, 4}]]

{bin1,bin2,bin3,bin4}

Head /@ %

{Symbol,Symbol,Symbol,Symbol}

ToExpression["bin" <> ToString[#] & /@ Range[4]]

{bin1,bin2,bin3,bin4}

Head /@ %

{Symbol,Symbol,Symbol,Symbol}

However, it generally easier to use bin[1], bin[2], ..., bin[n] as the variables


Bob Hanlon

---- Richard Trilling <rich.bis at wanadoo.fr> wrote: 

=============
Hello,

I would like to be able generate a list of numbers from 1 to n string 
format.

binlist={"1","2","3","4",..."n"}

I need to use them in this format to map into a list of variable names

binnames = Map["bin" <> # &, binlist] 




  • Prev by Date: Re: Generating a list numnber in string format
  • Next by Date: Re: Generating a list numnber in string format
  • Previous by thread: Re: Generating a list numnber in string format
  • Next by thread: Symbolic integration