MathGroup Archive 2006

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

Search the Archive

Re: dynamic variable definiton

  • To: mathgroup at
  • Subject: [mg67269] Re: dynamic variable definiton
  • From: albert <awnl at>
  • Date: Thu, 15 Jun 2006 03:25:45 -0400 (EDT)
  • References: <e6opcl$s4p$>
  • Sender: owner-wri-mathgroup at

T.Sariyski wrote:

> Hi,
> I have a list of lists. The first element of each list is a description,
> the rest are numerical. Is it possible dynamic to create variable and to
> assign values to them? For example, I read data with ReadList:

yes, look into ToExpression


I'm not sure, but I think you want the WordSeparators to be a space, not an
empty string???

> {{Face 1},{observ 0.1000E+02 0.3000E+01 0.4000E+01},{center 0.1050E+02
> 0.3000E+01 0.4000E+01},{e1 0.1000E+01 0.0000E+00 0.0000E+00},{e2
> 0.0000E+00 0.1000E+01 0.0000E+00},{e3 0.0000E+00 0.0000E+00
> 0.1000E+01},{v1 0.1050E+02 0.3500E+01 0.4500E+01},{v2 0.1050E+02
> 0.2500E+01 0.4500E+01},{v3 0.1050E+02 0.2500E+01 0.4000E+01},{v4
> 0.1050E+02 0.3500E+01 0.4000E+01}}
> I would like to have:
> Face=1;
> obsrv={0.1000E+02 , 0.3000E+01, 0.4000E+01};
> center={0.1050E+02, 0.3000E+01, 0.4000E+01};
> e1=... etc.

your output looks like every line is just a string, so you might needs some
string-processing before executing ToExpression. If you manage to get
somehing like:
line = {"obsrv","0.1000E+02","0.3000E+01","0.4000E+01"}



will do what you want. make sure that there are no definitions for any of
the "descriptions", otherwise you might see error messages...



  • Prev by Date: Re: linux front end tutorial
  • Next by Date: Re: dynamic variable definiton
  • Previous by thread: dynamic variable definiton
  • Next by thread: Re: dynamic variable definiton