Ken & Mike on the MATLAB Desktop

November 16th, 2009

Publish to PDF

Sometimes one of my colleagues comes up with a big idea that’s so brilliant, it can be succinctly summarized in a small phrase that downplays its impact. Publish to PDF pretty much says it all. In MATLAB R2009b you can now publish your MATLAB code directly to a PDF-file.

If you’re like me, you probably used to publish to doc and then use Google docs to convert it to a PDF. Well now you can go to PDF directly, and get a higher quality document than you would by going through Word and then to pdf.

That’s pretty much the whole peanut butter sandwhich right there. The easiest way to set this up is through a Publish Configuration.

Publish to PDF from a publish configuration

Here is an image of the output of the sine wave publishing demo (click to see a larger version):

Published PDF of sine wave demo

.

You can also watch this lovely video on how this new feature works.

November 9th, 2009

The redesigned Plot Selector in R2009b

The Plot Selector has been redesigned in R2009b! The user interface takes cues from the Function Browser with a search field at the top of the tool and the ability to “tear off” the window to keep it visible. We’ve tried very hard to reuse the same concepts in the user interface when it makes sense (e.g. the search field). This makes it easier for you to apply concepts from one tool in another tool, and keeps the overall look of the product consistent.

The Plot Selector is available via the    button in the Workspace Browser.

One of our overall goals with user interface design in MATLAB is to help you stay focused on what your doing. To do this, we need to offer you the right information at the right time. In the Plot Selector, this means showing you a graphic of what the plot might look like, as well as more detailed information about the what each plot does. We also show you details about a plot when you hover over it in the Plot Selector, which helps keep you “in flow”:

We also wanted to help streamline your workflow. If there are plots that you frequently use with a particular type of data, you can select the    button and promote that plot to the “Favorites” section, which appears at the top of the Plot Selector.

Finally, the Plot Selector now integrates with toolboxes. So if there is a plot that applies to your selected data, it will show up in the Plot Selector. For example, my Plot Selector shows plots from the Statistics Toolbox, because I have that toolbox installed:

We think this redesign will make it easier for you to plot your data and help keep you focused on the task at hand. What do you think?

November 2nd, 2009

Help browser search updates

Everywhere you look, searching is becoming the standard way of accessing information, and our documentation is no exception. In MATLAB R2009b we’ve updated the Help browser’s search functionality to help you find what you’re looking for more quickly. In this post I’ll give you a quick tour of the changes.

First, let’s take a look at the R2009a search results display. Using the default Help browser layout, here are the results of a search for “fft” with all MathWorks products installed:

fft_9a_doc_results.PNG

We weren’t happy that this display does not give you an easy way to differentiate among the top three results. They’re function reference pages from different products, but you’d never know it because the Product column is scrolled off the right side of the results area. If you want to see what products the results are in (or sort by product), you need to scroll over and lose sight of the title. There are a few other issues that we fixed, but that’s the big one.

Now lets see how the same search looks in R2009b:

fft_9b_doc_results.PNG

The first thing you might notice is that each result takes up a lot more vertical space, so you don’t see as many results. That’s true, but we think the new features are worth the tradeoff - we’re going for quality over quantity in the results. Let’s take a quick look at what we’ve changed:

  • There’s no awkward horizontal scrolling in the search results area, ever.
  • We’re using an icon to display the type of result - these icons are the same ones that are used in the top level of the new table of contents.
  • Demo search results are now listed together with the documentation results.
  • Each result includes some snippets from the result page, which shows the context in which the search term is used.
  • For reference pages, we’re including the summary line (for example, in the top result above we’re displaying “Discrete Fourier transform”).
  • The sorting options have changed.

About those sorting options… In R2009b sorting is all about organizing your search results. Now that we categorize results by type, that was a natural addition to the sort options. We also felt that the old options to sort by title or section didn’t provide a lot of value, so we removed them. To further emphasize the notion that sorting helps you organize your results, when you sort by type or product we group the results into collapsible sections. That way you can easily show or hide entire groups of results that you find useful or not.

We hope that these new features will help you find what you’re looking for when you search our documentation. Give them a shot and let us know what you think.

October 26th, 2009

The MATLAB Editor at your fingertips

Our friend Yair recently described on his blog how to use the various functionalities of the Editor by accessing its Java components. I imagine for many MATLAB users, especially those not familiar with Java, this is wading into unfamiliar territory. We don’t write very many APIs in Java intended for our users to access, and we like to abstract away the implementation components so we can be free to refactor behind the scenes. We’ve been spending time on refactoring projects, and so the Java APIs have been changing quite rapidly.

Over the years we’ve had a lot of requests for programmatic access to various desktop components, and we’re working on a MATLAB API for the Editor. In R2009b, this API is hidden in the product (aka undocumented), but we’re planning on bringing it out in a future release fully supported and documented. The api provides methods to manipulate the text, get information about the buffer, as well as close, save, and open editors. With the object provided users can manage the editor state, write scripts that call their favorite diff tool, open files in other programs, open the folder in the OS, etc.

The 9b version isn’t fully vetted or functional; it’s there to satisfy some back-end requirements. This means I’m officially saying not to use it and don’t complain when things don’t work, but… if you’d like to preview it, give it a go. All of the functionality is part of the editorservices package. A single buffer/file in the Editor is represented by the editorservices.EditorDocument class. These objects are constructed by calling the package functions such as editorservices.new(), editorservices.open(), and editorservices.getActive().

Here is a full list of the package function in MATLAB R2009b.

help editorservices
Contents of editorservices:

EditorDocument           - Encapsulates all user accessible behavior of the MATLAB Editor
EditorUtils              - Static utility methods for editorservices functions
closeGroup               - Closes the MATLAB Editor and all open documents.
find                     - returns an already open EditorDocument for a given file name
getActive                - finds the active (topmost) open buffer in the Editor
getAll                   - Gets all the Editors that are currently open
isOpen                   - true if the specified file is open in the editor
new                      - Creates a new buffer, with optional text
open                     - Opens the MATLAB Editor with the given filename
openAndGoToFunction      - open a file in the editor and highlight the indicated function
openAndGoToLine          - open a file in the editor and highlight the indicated line

You can try it out now, but keep in mind we’ve already already changed the API, fixed some of the bugs, and enhanced its functionality for its prime-time release, and so any code written with it will likely have to change when we release the documented API.

Please let us know how this new api fits (or doesn’t fit) into your workflows, and what future enhancements you’d like to see and what other Desktop components you’d like to work with programmatically.

October 19th, 2009

Is 7 your lucky number?


I’d like to welcome guest blogger Ken Atwell from the MATLAB Product Management team this week to talk about our support of Windows 7.

Here at The MathWorks we’ve been using and testing MATLAB against pre-releases of Windows 7 for some time now. And we know we’re not the only ones, as we’ve seen thousands of MATLAB activations under Windows 7, even though Windows 7 will not be formally release until the end of this week! I’m happy to report that we’ve fully tested and are now officially supporting the 32-bit and 64-bit versions of R2009a (including Student Version) and R2009b. You can see read our official statement here, and we’ve updated our System Requirements pages in the last several days accordingly.

We expect a smooth MATLAB experience when using these modern releases of MATLAB on Windows 7. We expect older versions of MATLAB to work as well (see our statement for potential gotchas), but is not a supported configuration. If you’re using R2009a, we did find one glitch unique to Windows 7 that was fixed for R2009b: If you shell out to the console with the ! shell escape “operator” in MATLAB, Ctrl+C often will not break out of an operation should you choose to abort it. There is no work-around beyond “don’t do that”. Again, this was resolved for 9b and seems to impact Windows 7 only.

Here are two nice usability improvements that I thought I would share:

  1. If you mouse over the MATLAB icon in the Windows taskbar, you’ll get thumbnails of all of your MATLAB windows. This may be helpful when you need to locate an undocked Figure window of a GUI that got itself stacked under the MATLAB Desktop or another application.

  2. The “Windows” key on your keyboard will pop-up the Start menu, which you can quickly filter by typing a character or two in the name of the app you wish to launch. No more hunting through the Program Files hierarchy! For me, Windows->”fi” is enough to find Firefox, Windows->”it” is enough to find iTunes, and (of course) Windows->”ma” finds MATLAB. This is great way to find and launch frequently-used applications while keeping your hands on the keyboard. (And, okay, I admit this feature was introduced in Windows Vista, but it is just too good not to share!)

What are your plans for migrating to Windows 7 (or are you already there)? Any productivity tips for fellow MATLAB users?

-by Ken Atwell, The MathWorks

October 12th, 2009

The history of keyboard shortcuts in MATLAB


I’d like to welcome guest blogger Christina Roberts from the MATLAB Editor team. Christina was the lead developer on the configurable keyboard shortcuts feature.

My last post gave an overview of how to use the new keyboard shortcut preference panel. This post is going to delve into the history of keyboard shortcuts in MATLAB, which will help make it clearer why we decided to change some of our default keyboard shortcut assignments.

The MATLAB desktop was developed over many years by a number of different developers. Although the developers attempted to follow platform standards for common actions, some MATLAB-specific actions were assigned different keyboard shortcuts in different desktop tools, depending on which developer created the tool. A good example of this, illustrated below in the legacy R2009a Windows Default Set, is the Open Selection action available across the desktop. In addition to the four different shortcuts that you can see below, there are a few tools with the action that have no shortcut at all.

Further complicating issues, the original keyboard shortcuts assigned to the Command Window were based on Emacs, regardless of platform. Other platform-specific shortcuts were also added to the Command Window, as long as they did not conflict with existing Emacs shortcuts; for example, Ctrl+O was added on Windows to perform Open, but Ctrl+A could not be assigned to the Command Window’s Select All action because Ctrl+A was the Emacs assignment for moving the cursor to the beginning of the line.

Before long, customers began asking for the ability to configure keyboard shortcuts in the Editor and Command Window, which were the primary desktop tools at the time. To help accommodate those requests, three default sets were developed for the Editor and the Command Window, and users could choose between those sets independently (with the caveat that the Macintosh set was only available on the Macintosh platform). To maintain backwards compatibility, the defaults remained as they had been, even though they were inconsistent between the Editor and the Command Window—the Command Window stayed with the Emacs-based shortcuts on all platforms, but the keyboard shortcut set selected for the Editor by default varied by platform. This was very confusing for new MATLAB users, who expected a more consistent user experience.

As MATLAB continued to evolve, additional tools were added to the desktop, and their keyboard shortcuts were hard-coded to the values that the individual developers felt made sense. So although users appreciated having some choice of keyboard shortcuts in the Editor and Command Window, we continued to receive many requests for customization of individual keyboard shortcuts across the whole desktop. This was particularly needed for customers using certain non-English keyboards, which simply could not trigger some of our default shortcuts.

Presented with the challenge of creating a new keyboard shortcut infrastructure, I had several requirements. I wanted to provide a way to unify keyboard shortcuts across desktop tools so that, by default, the same action had the same shortcut, regardless of where it was triggered. However, I knew that making such a change would introduce backwards incompatibilities and possibly annoy existing MATLAB users, so I wanted to ensure that flexibility existed for customers to achieve exactly the same hybrid configurations that we previously supported. At the same time, this flexibility could not be burdensome to users who desired to quickly change a keyboard shortcut across the desktop, without dealing with individual tools.

So now let’s take a look at the solution that I developed, using the Ctrl+A example discussed above. First, compare the Ctrl+A assignments in the new Windows Default Set to the assignments in the legacy R2009a set.

New Windows Default Set as of R2009b


Old Windows Default Set as of R2009a

In R2009a on Windows, Ctrl+A was not assigned to Select All in the Command Window, and instead had the Emacs-based assignment of Cursor Begin Line. Now, let’s assume that you are an existing MATLAB user and you have Ctrl+A committed in your muscle memory to going to the beginning of the line. You have 2 options—you can revert back to the legacy R2009a Windows Default Set, or you can modify the Select All and Cursor Begin Line assignments in the new default set.

Modifying the new default set is a far better long term solution if there are a relatively small number of keyboard shortcuts that are bothering you. If you stick with our new default sets, as new actions and tools are added to the desktop, you will automatically obtain their keyboard shortcuts—this is because we only store the customizations (differences) that you have made from our shipping defaults. In contrast, the legacy sets are complete listings of exactly what we had in release R2009a, and they will not evolve with new features.

So let’s change the assignments related to Ctrl+A in the new Windows Default Set. To do this, first click on Select All and then un-assign the Command Window from the list of tools with the Ctrl+A shortcut.

Then select Cursor Begin Line, press the button, and add a new shortcut of Ctrl+A to the Command Window only.

If you now search for Ctrl+A in the table of actions, and you will see that the assignments match the ones in R2009a.

That is a quick summary of how the new customizable keyboard shortcuts were developed. I hope that you find this feature useful, and I’d love to hear your feedback!

-by Christina Roberts, The MathWorks

October 8th, 2009

Midweek update: MATLAB Virtual Conference next week October 14th

MathWorks is hosting a MATLAB virtual conference on Wednesday, October 14. It’ll basically be like a regular conference but all the events, meetings, booths, etc will be online.

I will be facilitating forum discussions on MATLAB tips and tricks from 2-3pm and 4-5pm (Eastern). Fellow bloggers Loren and Jiro will also be hosting forum discussions.

October 5th, 2009

Slimming down the Help browser


I’d like to welcome guest blogger Chris Kollett this week from the MATLAB Help team to talk about the redesigned Help Browser.

If you’re a regular user of the Help browser, you’ll notice that its user interface has changed quite a bit in R2009b. One of our main motivations for these changes was to make the Help browser useful in layouts other than its default layout. Time and time again we’ve seen users struggle to use the Editor and Help browser at the same time, because they both work best when they’re laid out relatively wide. Since users can’t get them both on screen at the same time, they end up switching back and forth between them, wasting time and breaking their flow.

If you struggle to see your work and use the Help system at the same time, here are a couple of tips for making the Help browser take up less space in R2009b:

Close the Help navigator

Yes, really, close the Help navigator (the left side of the Help browser, where the table of contents and the search results show up). It used to be that if you closed the Help navigator you wouldn’t be able to navigate the doc at all - the table of contents, demos, and even the search field would go away with it. In R2009b, we’ve moved the search field up into the toolbar when the Help navigator is closed, and even more significantly, we’ve replaced the old location dropdown with a breadcrumb navigation widget that lets you access to the full table of contents and all of the demos from the toolbar. If you’ve always wanted the Help browser to give more space to the documentation without sacrificing so much functionality, R2009b should be a big improvement for you.

R2009b Help Browser Breadcrumb Navigation

Consider a taller, narrower Help browser

Prior to R2009b, it was virtually impossible to use the Help browser once you made it narrow. The Help navigator could only be positioned on the left hand side of the Help browser, and as we discussed above, you lost a ton of functionality if you tried to close it. So if you made the Help browser narrow, you had very little room left to display the documentation. In R2009b, we’ve introduced an alternate layout for the Help browser: if you resize the Help browser so that it’s tall and narrow, the Help navigator moves up above the contents. We’re hoping you’ll find it convenient to try some alternate layouts, like docking the Help browser in a narrow space next to the editor.

R2009b Help Browser Narrow Layout

Please try out these changes and let us know if they help keep you in your flow - we don’t want you to get bogged down in the Help browser and lose track of your work. We’ll look at some other changes to the Help browser in a later entry.

September 28th, 2009

Configurable keyboard shortcuts have arrived


I’d like to welcome guest blogger Christina Roberts from the MATLAB Editor team. Christina was the lead developer on the configurable keyboard shortcuts feature.

R2009b has a new feature that I am particularly excited about: user-configurable keyboard shortcuts for the MATLAB desktop. This is a project that has been in the works for several years, and I am thrilled that it is now officially released.

I will be splitting up my discussion of this feature into two posts. The first will give a high-level overview of the R2009b functionality, and the second will delve into the somewhat troubled history of keyboard shortcuts in MATLAB. I hope that you will learn some valuable tips from both posts and gain a better understanding of how to leverage customizable keyboard shortcuts.

First, let me explain the layout of the keyboard shortcut preference panel. You can open it from the File Menu: File -> Preferences -> Keyboard -> Shortcuts


The Active settings dropdown list at the top of the preference panel allows you to choose between different keyboard shortcut sets—those that ship with the product, and customized sets that you may obtain from colleagues or MATLAB Central. The shortcut set selected by default matches common keyboard shortcuts on the platform on which you are running. For Windows and Macintosh, these are based on Windows and Macintosh platform standards, respectively. On UNIX, we decided to base our default keyboard shortcuts on the popular Emacs editor; however, if you are more comfortable with Windows-based keyboard shortcuts, that option is also available on UNIX.

The Windows and Emacs sets are both available on non-Macintosh platforms, but the Macintosh Default Set is only available on Macintosh due to the usage of the Command key. In addition to our new default sets, we also ship a set representing the default keyboard shortcuts in R2009a, specific to the platform on which you are running.

To import a customized keyboard shortcut set, choose Browse… from the Active settings combo box and navigate to the location of the set’s XML file. If you would like to share your own customized set, use the Save As… button to create an XML-representation of the set.

The top table of the preference panel lists all the actions that are configurable. You can search the contents of this table using the search field above it. For example, let’s look at the actions relating to pasting an item from the clipboard:



You can see that there are three paste-related actions. The generic Paste action has the keyboard shortcuts Ctrl+V and Shift+Insert. These same keyboard shortcuts are also assigned to Paste to Workspace in the Workspace Browser, as indicated by the informational icon next to the actions as well as their tooltips.

The middle table is where you can change assigned keyboard shortcuts, remove existing assignments, and add new ones. Let’s assume that you want to change Paste’s Ctrl+V shortcut to Ctrl+Shift+P. To do this, click in the table cell displaying Ctrl+V and press your new keyboard shortcut. The text representing the shortcut that you just pressed will then be displayed. Note that you can also insert multi-stroke keyboard shortcuts, popular in Emacs, by selecting Limit to 2 keystrokes from keyboard shortcut editor’s context menu.

If you press the Apply or OK buttons, Ctrl+V will be replaced by Ctrl+Shift+P for all tools which support the Paste action. To see what tools these are, click in the table cell to the right of the new assignment. It is then possible to deselect some of these tools, if you do not wish for Ctrl+Shift+P to be assigned to Paste in all desktop tools.

Now let’s also assign Ctrl+V back to Paste in the Editor only. To do this, press the button under the middle table. Then press Ctrl+V in the shortcut field, and finally deselect all the tools for that shortcut except the MATLAB Editor.

Finally, the bottom table in the panel shows keyboard shortcut conflicts with the action currently being edited. In the example above, informational icons indicate that there are keyboard shortcuts assigned to Paste which are also assigned to Paste to Workspace. However, since the Workspace Browser does not support the default Paste action, this is not an actual conflict. To create a real conflict, try replacing the Ctrl+Shift+P assignment with Ctrl+P.



When you make that change, an error icon appears, indicating that Ctrl+P is assigned to two or more actions within the same desktop tool. This means that you cannot use Ctrl+P for both Paste and Print, but you can instead choose to unassign Ctrl+P from Print by selecting the first row in the bottom table and pressing the Unassign button.

If you now press the OK or Apply button, your modifications to the Windows Default Set will be retained in subsequent sessions of MATLAB. You can go back to the original Windows Default Set by selecting Restore defaults, or you could write this file out as a custom set by selecting Save As….

That is a quick overview of how the preference panel works. In a future post, I will discuss the history of keyboard shortcuts in MATLAB and explain how we made some of our design choices.

-by Christina Roberts, The MathWorks

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

File Exchange search

3. Go

File Exchange search

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:

  1. FAQ
  2. Watch the tutorial video

Ken & Mike work on the MATLAB Desktop team.
  • Ken: Hi Arsalan, Unfortunately there is no way to get the new Editor API in older versions of MATLAB. -Ken
  • Arsalan: Hi, I am very excited about the MATLAB API for editor because right now i am working on a project and i need...
  • Johannes: Since I started using matlab-emacs some days ago I never experienced Emacslink. But I experienced some...
  • Francisco J. Beron-Vera: Hi all, I have recently learned about ViEmu (http://www.vimemu.c om) which, for Vi/Vim...
  • OysterEngineer: When I first learned of the Publish feature in MatLab, I thought it might be useful to help to...
  • Ken: Hi Herve, I’m not quite sure what you mean by “stand-alone&# 8221; mode? -Ken
  • Herve: I wonder when the publish fonction will be supported in standalone mode.
  • Mike: Ravi, What you described should work as far I understand it. Please follow up with technical support. With a...
  • Mike: @Daniel, Thanks for that note.
  • Daniel Armyr: A word of caution when using this feature, though. It appears that in some cases when regenerating a...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.