Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Variable Listing?

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1087] Re: [mg1012] Variable Listing?
  • From: Paul Wellin <wellin at telospub.COM>
  • Date: Sun, 14 May 1995 20:31:28 -0400

One quite simplistic way to do this is to map the information you want
to extract across the list of names in the Global context. Here is a 
short session:

In[1]:= a = 1;

In[2]:= str = "some text"

Out[2]= some text

In[3]:= mat = {{1,2},{3,4}};

In[4]:= TableForm[
           Map[{#, ToExpression[#], ByteCount[#]}&,
              Names["Global`*"]],
           TableHeadings -> {None, {"Name", "Value", "Byte count"}}]

Out[4]//TableForm=    Name   Value       Byte count
                      a      1           12

                             1 2
                      mat    3 4         16

                      str    some text   16


I think you can see then, how to put whatever information you need into
this function (maybe TensorRank, Dimensions, Head, etc.)

> Is there a way in Mma to view all variables that have been
> defined during a current session?  For example, in Matlab
> I can use the "whos" command to get this display:
> 
> 
> >> whos
>               Name        Size       Elements     Bytes    Density   Complex
> 
>              bvolt     953 by 1           953      7624       Full      No 
>              calib     431 by 5          2155     17240       Full      No 
>           datedata       1 by 3             3        24       Full      No 
>                day       1 by 1             1         8       Full      No 
>               mass     953 by 1           953      7624       Full      No 
>              massc     431 by 1           431      3448       Full      No 
>              month       1 by 1             1         8       Full      No 
>             newday       1 by 1             1         8       Full      No 
>              nvolt     953 by 1           953      7624       Full      No 
>             nvoltc     431 by 1           431      3448       Full      No 
>           nvoltfit       1 by 953         953      7624       Full      No 
>          opt_depth     953 by 1           953     15248       Full      Yes
>            sundata     953 by 5          4765     38120       Full      No 
> 
> Such a command in Mma would be nice if it doesn't exist.
> 
> dan
> deslover at vil.ssec.wisc.edu
> 



_____________________________________________________________________
Paul Wellin, Editor
TELOS/Springer-Verlag                  phone: 408-249-9314
3600 Pruneridge Ave., Suite 200        fax: 408-249-2595
Santa Clara, CA 95051  USA             email: wellin at telospub.com




  • Prev by Date: Online documentation available?
  • Next by Date: Re: The Case of the Mystery Option
  • Previous by thread: Re: Variable Listing?
  • Next by thread: Pasting Mathematica notebooks into Word