Displaying a list of variables together with their names
- To: mathgroup at smc.vnet.net
- Subject: [mg111143] Displaying a list of variables together with their names
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Thu, 22 Jul 2010 05:40:07 -0400 (EDT)
Hello MathGroup,
I am looking for a simple and (code-wise) efficient way to display a
list of variables (simple symbols) together with their values in a
table. My Mathematica skills got a little rusty, I was wondering what
is a simpler / better way to achieve it than this:
SetAttributes[dynamicVariableDisplay, HoldAll]
dynamicVariableDisplay[vars__] :=
Dynamic@Grid[
Transpose[{{Function[x, SymbolName[Unevaluated[x]], {HoldAll}] /@
Unevaluated[vars]}, {vars}}], Alignment -> {{Left, "."}}]
a=1; b=2; c=3;
dynamicVariableDisplay[a, b, c]
There's too much juggling with unevaluated symbols.
Thanks for the help in advance,
Szabolcs