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