Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: labeling problem

  • To: mathgroup at
  • Subject: [mg46460] Re: labeling problem
  • From: Bill Rowe <readnewsciv at>
  • Date: Thu, 19 Feb 2004 03:02:17 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 2/18/04 at 12:36 AM, janos.lobb at (Janos) wrote:

>I need to assign  names to list elements in a nested list based
>upon their position in the nested list.  For example if I have a

>lst = {{a,b},{c,d},e,f,{g,h,i},j,k,{l.m},{n,o,p},q,{r,s},{{t}}}

>then pos=Position[lst,{_,_,_}] will give me


>Now, I am thinking to assign a unique name to the list elements on
>these positions, like p5={g,h,i} and p9={n,o,p}.  I did not find
>yet how to create variable names with concatenation auto-magically
>from program.  In other programming languages I can do something
>like this:


The Mathematica equivalent to this is

var = "p"<>ToSring[5]

And given lst and pos defined as above


will create variables p5 and p9 then assign {g,h,i} to p5 and {n,o,p} to p9
To reply via email subtract one hundred and four

  • Prev by Date: Re: labeling problem
  • Next by Date: Re: Bloomberg and Mathematica
  • Previous by thread: Re: labeling problem
  • Next by thread: Re: labeling problem