Ken & Mike on the MATLAB Desktop
January 28th, 2008
Exploring your data with datatips
In the spirit of encouraging you to try out cell mode, lets look at a feature that will help you keep your focus in the editor while crafting your cells.
As I mentioned in an a previous blog entry (Running functions with input from the Editor in R2007b) I find it extremely useful to access all the information I need for a particular task from one location. This is less disruptive to my workflow, which means less context switching - and that means I get more work done!
We’ve already seen how MATLAB’s cell mode lets you group sections of code and then interactively run them each in any sequence you choose. (I’ve got something to cell you). This is really helpful when experimenting with your code - but there’s still an unnecessary step in your workflow. After each run of the cell, you have to switch focus over to the Workspace Browser and inspect your variables to ensure everything is in good order. You can eliminate that context switch by turning on datatips.
Datatips allow you to mouse over any variable defined in the base workspace and view its contents. In fact, if you do much debugging, you may have already noticed this feature as it gets turned on during debug sessions.
To turn on datatips in edit mode, goto Preferences -> Editor/Debugger -> Display and select Enable datatips in edit mode.
Now when a variable is defined in your workspace, you can mouse over it in the editor and view its contents like this:
Note also that with datatips-in-edit-mode turned on, datatips will popup in any M-file your editing (not just those using cells).
Explore your data!
By
Ken Orr
Ken is a developer on the MATLAB Desktop team. He loves the art of graphic design as well as developing visually pleasing user interfaces - he's one of those 'crazy' Mac guys!
07:02 UTC |
Posted in Editor, Preferences |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
Very useful tip. I’m always typing “whos” into the command prompt to view the variables, but this way is much more efficient.
Thanks Quan. In addition to providing all the information whos supplies, datatips offers up the value of the variable as well…even if its an array.
-Ken
I like this feature in the debug mode, but I had to turn it off in the editor because it can be very distracting. There are times, however, when it would be handy, like the example you give with evaluating cells. It would be nice if there were (or maybe there is) a shortcut key combination to toggle this feature. What I currently do is highlight the variable in question and hit F9 to evaluate in the workspace.
Thanks for the feedback Eric. I agree that it could potentially be disrupting to have datatips on all the time. There is currently an open feature request to add quite a bit more customizability to datatips, and I’ve added your request for a toolbar button and/or shortcut key to toggle this feature to that request.
Note also that there is a MATLAB function that displays similar information to the datatips feature, aptly named datatipinfo. Maybe someone can come up with a creative solution using this function?
-Ken