Ken & Mike on the MATLAB Desktop
September 21st, 2009
The Front Page of the File Exchange: Your Desktop
It may seem backward in late 2009 that one of the great new features in MATLAB is integrating a web application, the MATLAB File Exchange, into the Desktop. However it’s not surprising to me that this arrangement works out quite well. Because the file exchange exists for sharing files created in and to be used in the MATLAB environment, this actually streamlines the workflow. This new tool solves the pain of making files from the exchange available and searchable right there without having to leave MATLAB.
The File Exchange window is not open by default, so to bring it up, use the toolbar menu: Desktop -> File Exchange.
Downloading is quite simple. Let’s say I wanted to download Ken’s breakpoint muting program:
1. Search
2. Download
3. Go
It’s pretty a simple feature, but the convenience factor is really there. You can search for toolbox functions using the Function Browser, and if we didn’t give you a particular function, you can then turn to the File Exchange and see if one of your friends on the web has already done the work for you.
The file exchange is an active and friendly community and if you’ve come up with useful program, we encourage you to share that with the community through the File Exchange web interface. If your program is up to snuff, it may even be chosen as the File Exchange Pick of the Week.
Resources:
- FAQ
- Watch the tutorial video
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
12:37 UTC |
Posted in MATLAB Central, web |
Permalink |
12 Comments »
September 14th, 2009
MATLAB-Emacs integration is back
I'd like to welcome guest blogger Eric Ludlam from the MATLAB Graphics team.
Little Things
Back in April of this year, Mike wrote a Desktop Blog article stating that it's the little things that count. In the comments to this article several people who were long time users of EmacsLink wrote in after discovering that the R2009a Editor interface stopped supporting EmacsLink.
As an author of a lot of Emacs code, and the current maintainer of the matlab-emacs project on Source Forge, and the guy who helped bring the original Emacs Link into existence, I was both glad to know that so many folks had found it useful, and sad that they had never joined the matlab-emacs mailing list over on Source Forge, where the many questions could be easily answered.
What is the matlab-emacs project?
The matlab-emacs project is a MATLAB mode for Emacs that consists of Emacs Lisp code that implements a major-mode for Emacs that assists in the editing of MATLAB scripts.
It also allows Emacs to be used in place of the MATLAB Editor for editing your MATLAB source code, debugging MATLAB code, and syntax/semantic checking of your MATLAB code with mlint.
The MATLAB mode for Emacs does NOT include "EmacsLink", which was a tool that more tightly integrated MATLAB and Emacs for purposes of debugging M code. "EmacsLink" only included the communication interface between MATLAB and Emacs. The editing mode has always been a part of the matlab-emacs project.
matlab-mode, which forms the root of the matlab-emacs project was first written by Matt Wette in 1991.
Where to get matlab-emacs.
The matlab-emacs project is hosted on SourceForge where the Emacs Lisp code can be downloaded from CVS.
Detailed download and installation instructions are available here.
Be sure to join the mailing list to get help on setting up and using the matlab-emacs project.
Once you have downloaded the code using your preferred method, read the INSTALL file for full details.
The matlab-emacs project has been expanded by it's users to include support for several features in CEDET. CEDET is an Emacs package that supplies an object system needed by the mlint support, and a complex completion/navigation package.
Writing MATLAB code in Emacs
Writing MATLAB code in Emacs is much like writing any other code in Emacs. The matlab-mode for Emacs has several features users have come to expect from Emacs, plus several features that make editing MATLAB code even better.
What I'm sure many users think of as a single "EmacsLink", as it shipped with MATLAB, had two parts. One part was communication between MATLAB and Emacs for debugging. The other was the MATLAB script editing mode.
Nothing has changed with the editing mode, except to make these tools even better, such as supporting the latest indentation styles, cell-mode, and programming constructs, such as the MATLAB Object System. As such, your editing experience in Emacs has only gotten better.
Setting up matlab-mode for Emacs is pretty easy. Here is an example simple setup:
(add-to-list 'load-path "~/path/to/matlab_dot_el")
(load-library "matlab-load")
;; Enable CEDET feature support for MATLAB code. (Optional)
(matlab-cedet-setup)
In this screenshot done with Emacs 23 on Linux, you can see some syntax highlighting, and mlint support for nested functions, and bold-face cross-function variables. The blue line over the nested function, and TAGS menu is part of the CEDET support that includes function browsing and completion. It also shows if/end block matching, and CEDET summary mode showing function details.
Currenlty, the matlab-mode for Emacs supports these features:
- Syntax Highlighting. There are three coloring levels supported.
- Smart indentation. The TAB key, and RETURN key will both indent your code lines. Indent region (C-M-\) for larger areas.
- Code auto-fill & Paragraph fill. M-q does an excellent job on large comments. Autofill is syntax aware, and can find nice places to put line breaks in code.
- Syntax aware block movement. Forward/Backward sexp (C-M-f,C-M-b), and Begin/End of function (C-M-a,C-M-e) correctly moves over begin/end syntax.
- Paren style matching for blocks. Highlight a matching end when the cursor is on an if, and many other matching constructs.
- mlint support. Highlight mlint warings in your code, and a convenient conext menu for tagging and navigating through errors. Some errors can be automatically fixed by Emacs.
- Highlight nested variables. Using mlint, nested variables are highlighted, assiting when working with nested functions.
- Completion engine. Using tools in CEDET, Emacs will parse your M files and provide pretty good completion and code decoration.
How to use Emacs instead of the MATLAB Editor
OK, now to answer many of the questions that have shown up in the comments to the Desktop blog. The most common question seemed to be "Why did you take EmacsLink away?", and Mike and Ken have done a fine job answering that. The real question should be "What should I do now?"
Thankfully, I have two answers, and you can choose the one that best suites your development style.
Using Emacs as an external editor.
You can use Emacs as an external editor now in a way that is similar to what EmacsLink provided.
One of the questions that showed up on the blog was was regarding using the preference panel to set Emacs as the default editor, and the complaint was:
- This creates a new emacs process every time I "edit" or "open" a different function. What should happen is that only the first "edit" should start a new session, and subsequent "edit"s should open the file in the existing session. I can pretty quickly have about 30 extra windows open on my desktop.
- Upon an error, clicking on the error link in the matlab command window opens the official editor, not emacs, even though I specified emacs in the preferences.
The answer to these problems is to use an old Emacs tool called emacsclient. Emacslient lets you tell an already running Emacs to load a file in for editing. To enable emacsclient in your emacs, add this line to your ~/.emacs file:
(server-start)
From the unix command prompt, you can now call emacsclient like this:
emacsclient -n myfile.m
and myfile.m will be loaded into Emacs for editing.
After researching this problem with the Ken and Mike, I have provided some simple tools for getting this setup. The matlab-emacs project now has a toolbox directory. If you were to install matlab-emacs in the directory ~/lisp/matlab-emacs, you can now place code like this in your startup.m file:
addpath('~/lisp/matlab-emacs/toolbox','-begin');
rehash;
emacsinit;
This will add the matlab-emacs project toolbox to your path, and the emacsinit script will configure MATLAB to tell an already running Emacs what to do when you type edit, or click on a link in the command window.
This screenshot shows a hand-setup where the location of emacsclient is specified as an argument to emacsinit. This is important on Windows because it may not be on your path. Now, when stopped in the debugger, you can click on the blue line number to jump to that location in some file. The file being debugged is a rubik snake demo I wrote a few years back.
This is a great step forward from just sticking the word "emacs" in the provided text field, but does not answer this question:
- And, of course, none of the other interactivity features are working .. no evaling code from emacs, no debugging, etc.
For this, you will need to use the Emacs command matlab-shell.
Using matlab-shell
The Emacs command M-x matlab-shell RET, on unix, will start MATLAB as a subprocess under Emacs. The command prompt will be available in an Emacs buffer the same way the unix prompt shows up if you type M-x shell.
If you use matlab-shell it will automatically configure your MATLAB as described in the previous section, allowing "edit" command to open files in a currently running Emacs. In addtion, Emacs will be able to send text from M files to the running MATLAB for execution.
Once the matlab-shell has been started, you can select "Run Region" or "Run Cell" from the menu while editing .m files. This will send the text from your source file to matlab-shell for execution.
If you just want to move the cursor to the shell, you can do M-x matlab-shell RET a second time to bring an already running shell forward.
In the above image, you can see the latest Aquamacs running matlab-shell. Selecting "Go to Last Error" or clicking the links moves the cursor to the typo that was introduced in my catapult modeling program.
To debug, you can use the toolbar to set breakpoints, or use the the db commands. For example:
dbstop in ls
ls
dbstep
dbstep
dbquit
This will cause the ls.m file to popup in an Emacs buffer, with the debug arrow pointing at the correct line. Stepping through this file, or into new files will move the arrow to the correct place.
For windows users
MATLAB does not support a tty command window on Windows so you cannot use matlab-shell. You will still be able to use emacsclient however. To do so, you will need to modify the setup configuration like this:
addpath('~/lisp/matlab-emacs/toolbox','-begin');
rehash;
emacsinit('c:/applications/Emacs/lib-src/emacsclient -n');
where you would replace the argument to emacsinit with the real path to your emacsclient binary on your system. The -n argument specifies that emacsclient should not wait for the user to finish editing the file.
Windows configuration of emacsclient is also not as easy as it is on Unix. You may need to read up on configuring your Emacsclient to work propertly before starting with the matlab-emacs configuration.
Make matlab-emacs better
The matlab-emacs project has been around for a long time, and its many contributors have made it a powerful way to work with MATLAB. If you want to Emacs as you editor, join the matlab-emacs mailing list, and help make it better.
Gratuitous Screenshot
The below screenshot includes matlab-mode with CEDET support enabled, matlab-shell running, editing, and debugging sliceomatic with ECB, the Emacs Code browser all running together.
Vim Users
For the vim users who also posted comments, the techniques used here for Emacs will also work with vim. Modifying the two MATLAB script files to call to vim instead ought to make it easy to start using vim, or just about any other editor, with MATLAB.
-by Eric Ludlam, The MathWorks
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!
13:11 UTC |
Posted in Debugging, Editor, Preferences |
Permalink |
7 Comments »
September 7th, 2009
New and Updated Desktop Features in MATLAB R2009b
R2009b (version 7.9) is here! You’d think that I’d be used to the six month release cycle by now, but there is always something to do with mad rushes interspersed with calm lulls. We’re preparing blog posts about the new features in R2009b and doing retrospectives. At the same time we’re wrapping up the development of new features in R2010a and starting to plan what we’ll do for R2010b and R2011a. It’s a long road ahead for us, but we’re working hard to incorporate all the great suggestions and feedback you’ve left us on the blog. Some of the stuff we’ll highlight over the next few weeks are things you’ve been asking for, and we’re happy to take feedback for the next iteration.
You’ll find the full release notes here. You can also find a video of the new Desktop features here. Below, I’ve called out some of my favorite new and updated Desktop features.
To get this latest release go here, or if you’re using R2008b or later, you can select Help -> Check for Updates.
Be sure to let us know what you think of these new features!
|
With R2009b you can customize the keystrokes associated with different actions across the desktop. As part of this we’ve had to change some of the defaults, and we’ve provided a few different sets that you might be familiar with. We’ll be explaining a lot more of this feature in future posts.
|
|
As part of the changes that happened to the File Exchange community a few months ago (mainly BSD licensing), you are now able to search and download/upload files directly to the MATLAB file exchange.
|
|
The Plot Selector has been enhanced to make it easier to select the plot type that you want. Bigger icons make it easier to see what kind of plot you’re selecting. You can also rearrange the order that the plots are shown based on which plots are most important to you.
|
|
The help browser has had a significant overhaul, allowing for better listing of search results, navigation through a bread crumb bar, improved layout when the help is docked in the desktop, and an overall freshening up of the user interface. We think all of these changes will make finding and reading the documentation easier.
|
|
The Current Directory Browser has been renamed the Current Folder Browser, and has received a number of updates. The biggest change is that you can now see the hierarchy of files rather than only the files in the current folder. You’ll also notice fresh new icons for the class, function and script file types. Another powerful feature is the ability to search within the current folder (including its subfolders) by pressing the magnifying glass icon next to the address bar.
|
|
The MATLAB publish function now supports PDF output.
|
What’s your favorite new feature or update?
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
11:43 UTC |
Posted in Configuration Editor, Current Directory, Desktop, Help Browser, MATLAB Central, Preferences, Publish, web |
Permalink |
3 Comments »
September 4th, 2009
R2009b is here!
R2009b is here, and with it come a host of great new features in the MATLAB Desktop. Mike will be giving a full overview of the new Desktop features on Monday, but I wanted to call out one particular feature that just can’t wait until then: fully customizable keyboard shortcuts
I think this is one of our most requested features, at least on this blog. Let us know what you think!
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!
12:45 UTC |
Posted in Command Window, Current Directory, Desktop, Editor, Help Browser, Preferences |
Permalink |
11 Comments »
August 31st, 2009
Pouncing on Snow Leopard
I’d like to welcome guest blogger Ken Atwell from the MATLAB Technical Marketing team this week to talk about running MATLAB on the newly released Snow Leopard.
If you are a Mac user, you’re probably as excited about the recent release of OS X 10.6 (“Snow Leopard”) as we are. We’ve been testing MATLAB with developer seeds of Snow Leopard for some time and we’re happy that everyone will now get to use it. You can expect our formal system requirements to be updated in the next several days.
We’re especially happy that Snow Leopard is being introduced at (almost) the same time as our R2009b release, which includes a shiny new native 64-bit version of MATLAB on the Mac. This will be a boon to anyone working with large data sets in MATLAB. On the user interface side, you can expect to see new features that Mac users will find especially agreeable – stay tuned to this blog over the next several weeks as we talk about the new UI features in R2009b. We also busily continue to remove the last vestiges of X11 from MATLAB. While it will take a couple more releases to completely expunge it, MATLAB is, for the most part, now free of its X11 heritage.
For those migrating to Snow Leopard, you can expect to see the resolution of a couple of irritating UI quirks:
- MATLAB correctly interacts with OS X’s Spaces feature (previously, application focus had never been set correctly).
- Application switching with the keyboard (Command-Tab and Shift-Command-Tab) also sets focus correctly.
- Figures have improved graphics performance.
Finally, we also have a few small things to look out for if you’re adopting Snow Leopard. We are working with Apple on all of these issues:
- There is a problem in R2007a and R2007b where the Command History window will not be displayed. While this may be addressed in a future OS X update, if you are still on these older MATLAB releases, we strongly encourage you to upgrade… MATLAB has come a long way on the Mac in the last two years.
- Data tips (the yellow pop-ups you see when you hover the mouse over a variable in the Editor) may show stale values.
- We have noticed that buttons at the bottom of some dialog boxes are clipped by a few pixels (see screenshot below). This is a cosmetic defect only.
We expect these issues to be resolved very soon in an Apple software update.
We look forward to hearing about your MATLAB experiences on Snow Leopard. Will you be upgrading to Snow Leopard in the near future? Do you plan on adopting 64-bit MATLAB?
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!
13:39 UTC |
Posted in Desktop, Install, Mac |
Permalink |
84 Comments »
August 24th, 2009
MATLAB webinars
A while back I pointed out how you could watch demos of various things within MATLAB, which serves mainly as a tool to learn about new features. The MathWorks also offers webinars on our website, all of which are free and tend to be much more detailed instructional style resources. You’ll find a catalog of past webinars here, and a listing of the upcoming webinars here.
The webinars span the breadth of MATLAB products, as well as the various levels of MATLAB users. Here are a few webinars you might find interesting:
Large Data Sets in MATLAB
MATLAB for Excel Users
MATLAB for Java Programmers
MATLAB for C/C++ Programmers
Speeding Up MATLAB Applications
Webinars are a great way to receive classroom style instruction, without needing to leave your computer. Have you watched any of the webinars?
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!
14:47 UTC |
Posted in web |
Permalink |
No Comments »
August 17th, 2009
Calling Java from MATLAB, Memory Issues
Following up with my previous post about using Java objects in MATLAB, this week I’m going to discuss the memory issues that can crop up.
When a Java object is created in the MATLAB workspace, it is actually created in the Java heap space and not the main memory used by MATLAB. On a 32-bit windows machine, MATLAB might have up to 3 GB available for creating matrices and other MATLAB objects but only 64 or 128 MB (by default) for creating java objects. To find out how much memory is available for creating Java objects, there are three numbers of importance: the free memory, the total memory, and the max memory.
The free memory is the number of bytes available in the heap space for creating new objects. The total memory is the number of bytes allocated to the total heap space which is the size of the objects created + the free memory. When the amount of free memory starts to get low, java will increase the total memory until it equals the the max memory. You can see this in the following animated graph, where the green (total memory) is bumped up when I create the large array of java doubles. The jumps in the blue represent the objects created as I manipulated the editor and command window to set up this demo, and the dips are when those objects get garbage collected, freeing up memory. The actual double array isn’t shown on this graph as it is created and cleared faster than the sampling time of the graph.
This is the demo that was running at the time of the jump: you can see the commands to discover the java memory, as well as the fact that the array creation ups the used java memory but does not affect the memory for MATLAB array creation:
free = java.lang.Runtime.getRuntime.freeMemory
total = java.lang.Runtime.getRuntime.totalMemory
max = java.lang.Runtime.getRuntime.maxMemory
feature(‘memstats’)
x = javaArray(‘java.lang.Double’,400000);
for i=1:400000
x(i)=java.lang.Double(i);
end
free =
13271784
total =
65470464
max =
130875392
Physical Memory (RAM):
In Use: 1911 MB (77755000)
Free: 1655 MB (677f0000)
Total: 3567 MB (def45000)
Page File (Swap space):
In Use: 2205 MB (89dd3000)
Free: 3243 MB (cab14000)
Total: 5448 MB (1548e7000)
Virtual Memory (Address Space):
In Use: 585 MB (24928000)
Free: 1462 MB (5b6b8000)
Total: 2047 MB (7ffe0000)
Largest Contiguous Free Blocks:
1. [at 320b5000] 459 MB (1cb9b000)
2. [at 4edf6000] 279 MB (117da000)
3. [at 21810000] 263 MB (107f0000)
4. [at 605d9000] 146 MB ( 9217000)
5. [at 6d346000] 71 MB ( 470a000)
6. [at 697f6000] 58 MB ( 3a3a000)
7. [at 71ce7000] 19 MB ( 1319000)
8. [at 73026000] 18 MB ( 126a000)
9. [at 7e4a1000] 18 MB ( 124f000)
10. [at 7d1d7000] 18 MB ( 1239000)
======= ==========
1352 MB (548cb000)
ans =
481931264
free = java.lang.Runtime.getRuntime.freeMemory
total = java.lang.Runtime.getRuntime.totalMemory
max = java.lang.Runtime.getRuntime.maxMemory
feature(‘memstats’)
free =
31137576
total =
102739968
max =
130875392
Physical Memory (RAM):
In Use: 1919 MB (77f2a000)
Free: 1648 MB (6701b000)
Total: 3567 MB (def45000)
Page File (Swap space):
In Use: 2238 MB (8be27000)
Free: 3210 MB (c8ac0000)
Total: 5448 MB (1548e7000)
Virtual Memory (Address Space):
In Use: 584 MB (248b8000)
Free: 1463 MB (5b728000)
Total: 2047 MB (7ffe0000)
Largest Contiguous Free Blocks:
1. [at 320b5000] 459 MB (1cb9b000)
2. [at 4edf6000] 279 MB (117da000)
3. [at 21810000] 263 MB (107f0000)
4. [at 605d9000] 146 MB ( 9217000)
5. [at 6d346000] 71 MB ( 470a000)
6. [at 697f6000] 58 MB ( 3a3a000)
7. [at 71ce7000] 19 MB ( 1319000)
8. [at 73026000] 18 MB ( 126a000)
9. [at 7e4a1000] 18 MB ( 124f000)
10. [at 7d1d7000] 18 MB ( 1239000)
======= ==========
1352 MB (548cb000)
ans =
481931264
One caution is that this space is shared between any objects you might create as well as objects created by the Desktop, Editor, Current Folder, etc. Once all the java memory is used up, there is the potential of locking up MATLAB, as there might not be enough room to even create an out-of-memory dialog.
There is a solution to running out of Java memory that is usually safe, although sometimes produces unintended consequences if the numbers are made too large. That is to create or modify a java.opts file in the MATLAB startup directory. This allows you to pass JVM options (such as the total and max memory for the heap) on MATLAB startup. Instructions can be found at this solution.
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
18:49 UTC |
Posted in Uncategorized, java |
Permalink |
No Comments »
August 10th, 2009
Tab to narrow completions
Tab completion is a great time saver for me, and helps me find a function when I can’t quite remember the exact name. There’s a little known feature that makes tab completion even more useful, though, and it happens to be off by default.
When you press tab in the Editor or Command Window, if there are functions that start with what you’ve typed, you’ll be shown a popup with a list of all the those functions. If you press tab again, then the selected item is inserted at the caret. But what if the popup is showing, and you want to filter down the list of things by typing more text? You can do that if you turn on the following preference:
Preferences -> Keyboard -> Tab key narrows completions (in the Tab Completion section)
When you press “p” at the command prompt, and then press tab, you’ll see a list of all the functions that start with “p”. So far, nothing is different.
But now, if you type “e” after the “p”, and then press tab, the list of items will be re-filtered, and you’ll see only items starting with “pe” .
Typing “a” with another tab really filters the list down into something usable.
You’ll have to press enter to accept completions now (instead of tab), which is an acceptable trade-off for me.
What do you think? Should this feature be on by default?
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!
11:00 UTC |
Posted in Command Window, Editor |
Permalink |
24 Comments »
August 3rd, 2009
More dialogs than you can shake a stick at
I’m going to continue my dialog discussion from two weeks ago with more of the MATLAB dialog gallery. I feel a bit like a car salesman, we’ve got so many dialogs to choose from. I’ve grouped them into two categories: dialogs for messages, and dialogs for setting/getting things.
The first group is the msgbox and it’s specialized variants: warndlg, errordlg, and helpdlg. Msgbox is a basic dialog that presents a message to the user with an “OK” button. The warning, error, and help dialogs are all special cases of msgbox with the icon pre-chosen:
The second group provides common dialogs that are either system, Java, or Handle Graphics based, depending on the dialog and platform. These are dialogs for dealing with files, printing, and picking fonts and colors.
File Picker(s)
uigetfile, uiopen, and uigetdir are all file/folder browsers for selecting a file from the system and returning the result to MATLAB. The uiputfile and uisave are for selecting files for saving as determined by whatever your program wants (uiputfile) or for saving workspace variables (uisave).
Here’s what they look like on Windows and MAC
Setting Fonts and Colors
Sometimes you want to present the chooser with a dialog specialized for selecting a complex data type. We’ve provided two dialogs: one for selecting fonts uisetfont, and one for selecting a color uisetcolor.
I didn’t cover printdlg and printpreview which are dialogs for printing MATLAB figure windows. I recommend checking them out on your own. There’s also a progressbar waitbar:
If all these predefined UI’s aren’t enough for you, check out the MATLAB file exchange. Last week’s pick of the week was STRUCTDLG, a dialog for editing the fields of a struct. This week they’ll highlight another submission in the same vein.
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
14:08 UTC |
Posted in MATLAB GUI |
Permalink |
3 Comments »
July 27th, 2009
Here’s what your Desktops look like
As promised (though admittedly a couple weeks late), here are the pictures of your Desktops. Only two screen shots were sent in and a couple text-only descriptions — not quite the level of participation I was hoping for. I guess I should have offered up chocolate peanut butter instead of MATLAB t-shirts!
Brett Shoelson, using 7.8 (R009a)
I have several layouts, and I toggle between them depending on what I’m working on. When I’m playing with images (which is much of the time), I like to give my editor and my figure window prominence. Everything is docked. My Editor and Help windows are stacked; my Workspace Browser, Command History, and Current Directory Browswer are stacked and given little space; and my Figure Window is docked on the top left. That gives me a good way to interact with the images.
Matt Fig, using 7.4 and 7.5 (R007a and R2007b)
Here is my favorite setup for my MATLABing sessions. As you can see, I like it simple. I do use the command history, although maybe only 2-3 times a month. That is the reason it is almost blocked out, I can easily get to it by sliding the command window over yet it is not in my way.
I personally feel that using all of the newer tiled windows is very distracting. These little windows both distract and shrink the available command window size. In my opinion they are not necessary at all, and I get the functionality by writing my own functions to do some of these tasks. For example: for easily loading M-Files, MAT-Files and figures, I wrote WHATS. For dealing with variables, I wrote WHOMS and other functions I haven’t put on the FEX. I much prefer something to be there when I need it, yet NOT be there (at all!) when I don’t.
That being said, the one extra I do use, only on work computers, is the shortcut bar. This is useful for launching GUIs quickly. Even then I probably wouldn’t use this at all if it wasn’t for the fact that I set it up this way when I write a GUI for someone else to use, on their computer. I know many people cannot remember the name of the GUI to launch it, so this little bar is handy in this circumstance.
Christian Peel, using 7.6 (R008a)
(no screen shots)
The only thing that I have Matlab display is the command window. I edit in emacs or xemacs via emacslink, and also use that interface for debugging. Obviously I don’t use R2009a, since emacslink has been disabled in that release; I use 2008a.
You’ve made vague hints in the past about the possibility of scripting the editor; an API or a powerful utility for editor keybindings and macros is even more essential now that you’re dropping emacslink. If I’m to ever use the Matlab edtior, I’d like customizable keybindings for opening files, switching tabs, and every possible thing one could do in the Matlab editor. I don’t want to be required to take my hands off of the keyboard when I’m editing and debugging.
Kevin using 7.8 (R009a)
(no screen shots)
I dual monitor my desktop so I typically have the Matlab editor undocked and taking up the main monitor. On the 2nd monitor I have the Variable Editor and the workspace taking up the upper half of the desktop and the command window and command history on the bottom. I use the variable editor and workspace to dubug a lot of my code and see what exactly is going on with the variables. After reading a prior post I’m going to look into docking the Matlab help, I think that would be very convenient.
Ustun Ozgur (version not specified)
(no screen shots)
I use KDE as my window manager on Linux. I use multiple desktops, and each different application resides in a different desktop.
I keep only MATLAB on Desktop 3 for example, so to switch to MATLAB application, I just press Ctrl-F3. To switch to another application, web browser, for example, I switch to the first desktop etc. So, I rarely need to use Alt-Tab, and that way, I can be sure that I will switch to MATLAB when I press Ctrl-F3.
I use two monitors, a 22′ LCD and a 17′ CRT. I keep the Command window on the right monitor, maximized; and the editor window on the left monitor, again maximized. I don’t use Workspace, Current Directory etc. I sometimes go full screen to get even more space, using Alt-F11 in KDE.
I use the window switching shortcuts a lot (Ctrl-0 for command window, Ctrl-Shift-0 for the editor, Ctrl-4 for the doc). I usually use common commands like cd, pwd to navigate through directories, and use the edit command extensively to open files, rather than rely on the GUI. Sometimes I have several files, and rather than trying to select the correct file from the tab bar, I simply type ‘edit filename.m’ to switch to it. (Actually, I rarely type that whole thing thanks to auto completion by the up arrow key, I usually simply type ‘ed’ and then press Up.) To open a particular file in which I remember which variable was used, I use a function ‘g’ to search for that variable, it finds the file using ‘grep’ in File Exchange, and I simply click the hyperlink to open the file in the Editor.
The g function is below. I use the grep created by us here but made the following modifications to ignore case by default, and print line numbers by default:
———–
Change line 84 from
‘-i’ true 0 [] 0 ‘ignore case’
Change line 89 from
‘-n’ true 0 [] 0 ‘print line number’
———–
function g(string,r)
% Searches for the string in m files
% Usage:
% "g snr" searches for snr in the current dir
% "g snr 1" searches for snr in the current dir and subdirs
if ~exist('r'), r = 0; end
if r
grep('-r', string,'*.m')
else
grep(string,'*.m')
end
I use emacs-style keybindings, and smarttab. Other than these, I have some shortcuts, but use them rarely. I use emacs when I’m not programming a GUI, and when I don’t debug.
One last tip for KDE users is that when I press F1 to read documentation in command window, Alt-F5 which maximizes the window works for that little documentation window, so I don’t have to switch to Doc viewer, or I can view two Docs simultaneously.
Yair Altman using 7.4 and 7.5 (R007b and R2008a)

I normally use R2007b. I have access to R2008a, but my largest client uses 7b so I usually use that version. I find that except for the improved code-folding on later versions (and the new java EDT functions), there aren’t many features I really miss in 7b, so it suits me fine.
I keep my Editor in a separate window from the desktop. The reason for this is because I typically write large m-files - large both in width (my code/comment lines often reach 100+ chars) and in length - some files are thousands of lines long. I know that coding extremely large source-code files goes against several important software-engineering practices, but I find that for me it is much easier to code and maintain a well-commented large file than dozens of small files. Anyway, I need plenty of real-estate for my editor, and so it gets its own large window. In it, I typically arrange all the file tabs on the left - this is handier than the default bottom layout, since it enables easy document switching when I have several dozens of files open as I typically do (just imagine the difficulty in managing the same number times 20-50 if I didn’t use large files in the first place…
My desktop usually has the workspace on the left side, with #bytes and class information replacing the default Min-Max fields. This is very useful in my work, which often uses Java and Matlab class objects, complex data structures, and more memory issues than I would care to have. the majority of the desktop area is reserved for the Command Window, which I heavily use for debugging. I often list (’disp’) the complex data structures there, and so I want to have a large area to easily display the data and pinpoint what I need. The history and profiler panels often reside next to the Command Window, hidden from view until summoned (see attached screenshot). Like Ken, I too use the shortcuts menu for often used projects/tasks. I typically reduce the desktop font to 8-9 pixels (depending on the display), in order to cram more data into my desktop & editor. Setting the font face/size, setting compact format, and increasing the history from 5K to the maximum are usually some of my very first actions when setting up a new environment.
For documentation, I usually use the Command-Window ‘help’ or simply open the file (via Ctrl-D in the Editor) to read its help section(s). I find this to be much faster than the ‘doc’ command, or even worse - the online documentation. Sometimes I use them when the text-based help is insufficient, but the help text is usually good enough for me. When I do open doc, via the help links, or via the ‘docsearch’ command (which is surprisingly better/faster than the standard ‘doc’ command), I use a separate window since the doc window seems too crowded when docked in the desktop.
I do not use docking for my figures - each has a separate window, which is often maximized. The reason is that I typically display figures heavily-laden with data plots and/or uicontrols, and they also seem crowded when docked. When I don’t need them, I simply minimize them to the Windows task bar.
My favorite desktop feature is undoubtedly the debugging integration between the editor and the desktop.
Thanks to all those who sumbited their Desktop configurations!
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!
12:25 UTC |
Posted in Desktop |
Permalink |
6 Comments »
|
|
Recent Comments