Loren on the Art of MATLAB

Turn ideas into MATLAB

Note

Loren on the Art of MATLAB has been archived and will not be updated.

The MATLAB R2012b Desktop – Part 3: MATLAB Apps

Today, David Garrison, our guest blogger, will complete his series on the R2012b Desktop.

  • Part 1: Introduction to the Toolstrip
  • Part 2: Customizing the R2012b MATLAB Desktop
  • Part 3: MATLAB Apps

Here is Part 3 of the series.

Contents

What have we learned so far?

In Part 1 of this series, I provided an introduction to the new Toolstrip in MATLAB R2012b. In Part 2, we talked about all of the new ways you can customize the R2012b MATLAB Desktop. Today we'll talk about an exciting new feature in R2012b -- MATLAB Apps.

The Apps Tab

We saw a bit about the Apps tab in Parts 1 and 2 of our series. Now let's talk about the Apps tab in more detail. The first thing that you need to know about the Apps tab is that it is where you go to launch interactive MATLAB programs (apps). Here's a reminder of what the apps tab looks like.

That long strip of icons on the tab is called the apps gallery. An expanded view of the gallery appears when you click on the downward pointing arrow on the right side.

When you first install MATLAB R2012b, your gallery will look something like that shown above. It will contain apps that come with the MATLAB toolboxes that you have installed. Your gallery may look different depending on what toolboxes you have. The apps in the gallery are organized by product categories. For example, the Math, Statistics, and Optimization category contains apps from all the math related toolboxes (e.g., Statistics, Optimization, etc.). If you hover over any of the app icons, you will see a longer description of the app and the toolbox to which it belongs.

When the gallery is expanded, you'll see a search bar at the top. You can type in a search phrase to find the app(s) you are looking for. The two buttons on the right allow you to toggle between the icon view (the default) and the details view.

If you just have MATLAB (no other MATLAB products), your apps gallery will be empty. Don't despair, you can add new apps written by other members of the MATLAB community. More on that later.

Customizing the Apps Gallery

The apps gallery can be customized in several ways. Categories can be moved around by using the "Top" button on the right side of each category. Notice that the Favorites category will always be at the top but otherwise you can re-order the categories to best suit your needs.

You can also add, remove, or re-order the apps in your Favorites category. The star symbol next to an app indicates that it is in the Favorites category. You can add an app to the Favorites category by right-clicking on the app and selecting "Add to Favorites" or by hovering over the app and clicking on the empty star next to the app icon as shown in the picture below.

Removing apps from the Favorites category works in a similar way.

To change the order of apps, just drag and drop an app icon to the desired location in the Favorites section.

Getting More Apps

The great thing about apps is that you can write your own, package them up, and share them with others in the MATLAB community. For R2012b, there are a set of apps available on the MATLAB File Exchange that you can download, install and start using today. Over time, we expect more and more people to create and share their apps using the File Exchange.

To get apps from the MATLAB community click on the Get More Apps button on the left of the Apps tab. That button will take you to a web page with some general information about apps.

Click on the big blue button that says "Explore Apps on MATLAB File Exchange". You will then see a list of all the apps available for download from the File Exchange.

If you see an app that you think is interesting, click the Download App button on the right side of the File Exchange page for that app. You can then save the .mlappinstall file to any convenient folder. That file is all you need to install the app into your app gallery. To install the app, just right-click on the .mlappinstall file and select Install or use the "Install App" button on left side of the Apps tab. The app will be installed and will appear in a new "My Apps" section of your apps gallery. I'll show you the basic steps:

Step 1: Download the app

Step 2: Open the zip file and right click on the .mlappinstall file to install the app. You can also save the file to a directory then install it.

Step 3: View your newly installed app in the apps gallery

You can put your newly installed apps in your Favorites section like I've done in Step 3 above. To delete a downloaded app, right-click on its icon in the apps gallery and select "Uninstall". That's all there is to it!

Creating and Sharing Your Own Apps

So let's say that you've created something that you think would make a good app and you want to share it with others in the MATLAB community. What do you need to do?

First, a few words about what makes a good app. Apps are launched from the apps gallery which puts some additional constraints on how they're written. Here are a couple of things to keep in mind when writing an app.

  • Apps are interactive applications written in the MATLAB language.
  • Apps have a graphical user interface.
  • Apps should not require any input arguments.
  • All interaction with the app should be through the graphical user interface.
  • Apps should be reusable -- a user shouldn't have to restart the app to use different data or inputs.

Sharing apps on MATLAB File Exchange introduces some additional conditions including release under a BSD license and restrictions on the use of binary files such as MEX files, p-coded files or dlls.

To share your app with others, you will want to create an .mlappinstall file just like the ones we discussed above. To do that, click on the "Package App" button on the left side of the Apps tab. A dialog appears that will guide you through the steps of packaging your app into an .mlappinstall file.

Read all about this dialog for packaging apps in the R2012b documentation or see an example in this video. I'll just give the highlights here.

To package an app, start with the information in the left-most section of the dialog. First specify the main file for your app. Once you do that, the tool will try to determine all the other MATLAB files that are needed for the app to run. If you have other files not found by the tool (e.g., image files, mat-files, etc.), you can add them yourself. Next, move onto the middle section and enter the information about the app including name, author, summary, description, and version. You can also supply a screenshot for your app. Finally, click the "Package" button in the right-most section of the dialog.

Here's an example of how the dialog looks after you've entered all the information and are ready to package your app. I've used an app from the File Exchange written by Brett Shoelson, a colleague of mine here at MathWorks. You can find this app here if you would like to try it out.

The Package App dialog creates an .mlappinstall file. In the example above it would be Intensity Adjust.mlappinstall. Once you have the .mlappinstall file for your app you can share it with colleagues or submit it to the MATLAB File Exchange to share with the entire MATLAB community. If you download and install the Intensity Adjust app it will look like this:

Have you used the apps tab?

Have you tried out the apps tab yet? Have you downloaded any apps from the File Exchange or packaged an app of your own? I'd love to hear your thoughts here.

Conclusions

Hopefully this series of posts has given you a good introduction to R2012b. There's a lot of new stuff to digest in this release. Try these things out and let me know what you think.

Thanks to Loren for letting me take over her space for the last few weeks.




Published with MATLAB® R2012b


  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.