MathGroup Archive 2006

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

Search the Archive

Re: String Input and Variable Setting

  • To: mathgroup at
  • Subject: [mg64183] Re: String Input and Variable Setting
  • From: bghiggins at
  • Date: Sat, 4 Feb 2006 04:13:36 -0500 (EST)
  • References: <drq077$moa$><> <drus9c$fs8$>
  • Sender: owner-wri-mathgroup at

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} //

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

and then remove the remaining HoldForm in later post processing.

Hope this hlps,


  • 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)