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
- References:
- Re: String Input and Variable Setting
- From: bghiggins@ucdavis.edu
- Re: String Input and Variable Setting