MathGroup Archive 2006

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

Search the Archive

Re: String Input and Variable Setting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64183] Re: String Input and Variable Setting
  • From: bghiggins at ucdavis.edu
  • Date: Sat, 4 Feb 2006 04:13:36 -0500 (EST)
  • References: <drq077$moa$1@smc.vnet.net><200602020505.AAA16005@smc.vnet.net> <drus9c$fs8$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Another way is the following:

Assign the variable  say header to your table but wrap your table with
HoldForm such as

header = HoldForm[{{var1, 23 + 24, name1},
     {var2, 12, name2}}];

In the above highlight the following text portions "header= Holdform["
and  "];"   and change the text color to white  so that the user only
sees the table.

Then for post processing use a ReplaceAll to get inside the HoldForm
such as

val1 = header /. {var_, y_, z_} :> Rule[var, y] // ReleaseHold

{var1 -> 47, var2 -> 12}

You can replace Rule with Set or any other function.  Note if the user
has to enter something like

header = HoldForm[{{var1, 23 and 24, name1},
     {var2, 12, name2}}];

the output after applying the above ReplaceAll is

{var1 -> 552 and, var2 -> 12}

You van then use

val1 = header /. {var_, y_, z_} :> {var , HoldForm[y], z} //
ReleaseHold

{{var1, 23 and 24, name1}, {var2, 12, name2}}

and then remove the remaining HoldForm in later post processing.

Hope this hlps,

Brian


  • Prev by Date: Compile arguments
  • Next by Date: Re: how to visualize 3+D normal density contour?
  • Previous by thread: Re: Re: String Input and Variable Setting
  • Next by thread: Re: Trying to animate the rotation of a plane about an axis using dynamic visualizer - MoviePlot3D.nb (0/1)