Despite the recent improvements to Mathematica's statistical/data analysis tools it still doesn't have a built-in workspace interface for organizing and interacting with user defined variables/expressions like Matlab and R do (please correct me if I am wrong!). For those of you who are unfamiliar with Matlab here is a screenshot of its workspace browser that I would like to emulate in Mathematica:

enter image description here

This topic came up several years ago in StackExchange and a few approaches were suggested:

Is there an equivalent of MATLAB's Workspace window in Mathematica?

I am trying to customize these approaches for my needs, which is basically to keep track of lists of data. I am playing around with the following code which combines a couple of the approaches from the earlier StackExchange discussion.

  Dynamic[(* dynamically update values in pop-
   up window as variables change *)
     With[{expr = ToExpression@# (* 
         make expressions out of names of symbols in Global context \
*)} ,

         PasteButton[ToString[#]](* the name of the expression *),

         the Head of the expression to make sure its a list *),

         Which[(* Which finds Lists *)
          ListQ[expr] (* 
          if expr is a list then display its Dimensions *),

          ] (* close Which *),

         ByteCount[expr] (* memory size of the variable *),

          Style["Display", 10], 
            WindowTitle -> ToString[#], 
            WindowElements -> {"VerticalScrollBar"}]
          ] (*close "Display" Button *),

         Button[Style["Clear", 10], 
          ToExpression["Clear[" <> # <> "]"]] ,

         Button[Style["Remove", 10], 
          ToExpression["Remove[" <> # <> "]"]]

        ](*close With *)& /@ Names["Global`*"] , (#[[2]] == List) &](* 
    close Select *), Alignment -> Left](* close Grid *), 
   UpdateInterval -> 1, TrackedSymbols -> Full](* close Dynamic *),
  WindowTitle -> "Global Lists", WindowSize -> {Fit, Fit}, 
  WindowElements -> {"VerticalScrollBar"}](*close PaletteNotebook*)]

There are a few more things I would like to be able to do that I can't get working:

i.) When I highlight the list name in the first column with PasteButton it pastes the name of the list back into the active notebook but with quotation marks around it. How can I get PasteButton to paste without these quotation marks so I just have the name of the list ready to be used?

ii.) The Display button is to create a pop-up PaletteNotebook that just shows the contents of the list. However, the pop-up PaletteNotebook created by the "Display" button is of inconsistent size. A fixed size doesn't seem appropriate but maybe some minimal size is. How can I fix this?

iii.) If I have a vector (list) for the independent variable (usually contains time stamps) in the list, how can I create a button to automatically select and plot a dependent variable vector (list) of interest against the independent variable?

  • $\begingroup$ are there any videos anywhere that show the kind of interface you are seeking? $\endgroup$ Nov 14, 2015 at 22:38
  • $\begingroup$ See above for a screenshot of Matlab's workspace browser $\endgroup$
    – user13999
    Nov 15, 2015 at 16:18
  • $\begingroup$ I mean the window that pops up to display a list of interest has no consistent aspect ratio or size. If the list is a 1D vector the window may be a long, skinny vertical window. If the list is a huge matrix the window may stretch over the whole screen. I'd like this to be more predictable but not necessarily of fixed size. No reason to use the whole screen for a 1D vector but I do want to be able to read the name of the variable in the WindowTitle every time I display it. $\endgroup$
    – user13999
    Nov 15, 2015 at 18:57
  • $\begingroup$ @user13999 I see. What about iii? $\endgroup$
    – Kuba
    Nov 15, 2015 at 19:35
  • $\begingroup$ @Kuba For iii.) I wanted to be able to plot on the fly. If I have a 1D vector of dependent variables and another 1D vector of timestamps I want to be able to click on the timestamp vector and the dependent variable vector and plot the dependent variable vs. timestamps. This one would be nice to have but actually i.) is the most annoying to me right now. I can't get rid of the quotation marks around the expression names when I paste them back to the active notebook with PasteButton. Seems like this should be easy to fix but I haven't found a way yet. $\endgroup$
    – user13999
    Nov 15, 2015 at 19:49

1 Answer 1


Ad i. PasteButton[RawBoxes @ "myList"]

Ad ii. I've put there a fixed size of the window and additional pane to scroll through

Ad iii. Prepare plot button opens a dialog to pick lists to plot. You can pick one or two, if two are picked then Transpose@{list1, list2} is used. I'm not checking correctness of the input.

  DynamicModule[{initPlot, arrays, display},
           expr = ToExpression@# 
           }, {
           Dimensions[expr] ,
           ByteCount[expr] ,

           Button[Style["Display", 10], 
            CreateWindow @ PaletteNotebook[
              Pane[TableForm@expr, 400 {1, 1/GoldenRatio}, 
               Scrollbars -> True, AppearanceElements -> None], 
              WindowTitle -> #, WindowMargins -> Automatic, 
              WindowSize -> 400 {1, 1/GoldenRatio}]]
           Button[Style["Clear", 10], ClearAll@#],
           Button[Style["Remove", 10], Remove@#]

           }   ] & /@ arrays[]
       , Alignment -> Left
      UpdateInterval -> 1, TrackedSymbols -> Full
     Button["Prepare plot", initPlot[], Method -> "Queued", 
      ImageSize -> CurrentValue@"DefaultButtonSize"]
   Initialization :> (
     arrays[] := Select[Names["Global`*"], Head[ToExpression[#]] === List &];
     initPlot[] := CreateDialog[
       DynamicModule[{names = 1, picked},

            Which[Length[#] <= 2, picked = #, True, 
              picked = #[[-2 ;;]]] &], arrays[]],

             If[Length[picked] == 1, ToExpression@First@picked, 
              Transpose[ToExpression /@ picked]];
           Enabled -> Dynamic[Length[picked] > 0],
           Method -> "Queued"]

       Modal -> True
  WindowTitle -> "Global Lists", WindowSize -> {Fit, Fit}, 
  WindowElements -> {"VerticalScrollBar"}
  • $\begingroup$ Very cool how you did the plotting, and scroll bars seem to be working well. Thanks again for alerting me to RawBoxes. This will save me some headaches keeping track of lists. I really hope Mathematica comes up with a professional workspace in the very near future- seems to me this feature is long overdue. $\endgroup$
    – user13999
    Nov 15, 2015 at 23:07
  • $\begingroup$ Quick follow-up: I just noticed that when I use the Clear and Remove buttons or define new lists I'm not seeing the Global Lists window update. Is this the case for you too? Any idea how to correct this? $\endgroup$
    – user13999
    Nov 16, 2015 at 0:31
  • $\begingroup$ @user13999 what OS and version you work with? For me it works fine (win7 V10.3) $\endgroup$
    – Kuba
    Nov 16, 2015 at 7:29
  • $\begingroup$ Actually, I just closed and reopened Mathematica (win7 10.0) and now it works again. Thanks again for your help. $\endgroup$
    – user13999
    Nov 18, 2015 at 0:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.