Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

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


  • Prev by Date: Re: FDTD Code or Example? (2D wave eqn, rect grid, coords x,y,t)
  • Next by Date: Re: Axes all around
  • Previous by thread: Re: Strange 26base enumeration
  • Next by thread: Re: Displaying a list of variables together with their names