In my travels, I meet with many customers and they are always interested in learning about new MATLAB features and capabilities. One area that has a lot of interest is MATLAB app building. Many MATLAB users are interested in App Designer, GUIDE, and the future of the two app building platforms. So for this blog, I thought I would put some of those questions to Chris Portal, Development Manager for MATLAB Graphics & App Building, and David Garrison, MATLAB Product Manager.
- What is the current state of app building in MATLAB?
- Why did MathWorks develop a whole new app building platform?
- How does App Designer compare to GUIDE?
- What does that mean for the future of GUIDE and the apps users have built with it?
- What about users who create their apps programmatically?
- What about apps that use Java extensions?
- How do users take their apps to the Web?
- How do users decide which app building platform is right for them?
- How are you building apps in MATLAB?
CP: Currently MATLAB offers two platforms for building apps – GUIDE and App Designer. GUIDE is an older platform that MATLAB users have been using for many years. Although users have been able to build apps of varying levels of sophistication with GUIDE, it has suffered from a number of workflow and usability issues we’ve been wanting to address for our users. Similarly, the component set it supports, which is predominantly the uicontrol set, is also very limited and based on some legacy technologies.
DG: In R2016a we introduced App Designer as our new app building platform. App Designer integrates the two tasks of building an app – laying out the visual components and programming the behavior. It has a new design canvas that makes it easier to add components and to organize them using tabs and panels. It includes a built-in editor that manages generated code for components in read-only sections and provides editable sections for user-written callback code. It also supports a new family of standard components such as edit fields, buttons, and spinners, as well as gauges, knobs, switches, and lamps for creating instrument panels.
DG: When we introduced App Designer in R2016a, it offered a modern and user-friendly environment for laying out your app, which addressed several usability issues GUIDE has. However, for the first few releases, App Designer had some functional gaps with respect to GUIDE. Common components were missing, MATLAB graphics support was limited, and performance didn’t scale for large apps. With each release, we have been closing these gaps and addressing performance. As of R2018a, App Designer supports nearly all MATLAB 2D and 3D visualizations with pan, zoom, and rotate interactivity; menu support has been added as well as new tree and date picker components; and the code editor is able to scale to build large apps.
CP: Another notable difference is the coding model. App Designer generates a MATLAB class for the app, making it easier to program callbacks and share data between different parts of the app in a way that is less error prone than GUIDE. What this means is you no longer need to update a handles structure, or understand the subtleties of when to use guidata vs. appdata vs. UserData. New MATLAB interfaces have also been introduced which are designed specifically for each component. These new interfaces are easier to program to and improve on the older uicontrol component used by GUIDE.
DG: We know that many MATLAB users have time and intellectual property invested in GUIDE-based apps or in apps they've created programmatically. We will continue to support GUIDE and its associated components and have no current plans to deprecate or remove any of that functionality. Unlike other MATLAB transitions, GUIDE and App Designer can co-exist, which allows us and our users to work through the transition over a series of releases. Our focus right now is on enhancing App Designer to ensure it can serve the needs of MATLAB app builders and helping GUIDE users adopt it.
CP: Towards that end, we have released the GUIDE to App Designer Migration Tool for MATLAB in R2018a which eases the process of converting a GUIDE-based app to App Designer. The tool automatically creates an App Designer app with the same layout as your GUIDE app, applies the necessary component configurations, and copies the GUIDE callback code over. From there, you update the callback code to make it compatible with the new App Designer code format. To help users with this step, the tool generates a report that describes how to do the code updates and provides workarounds for some limitations. You can download the tool from the File Exchange on MATLAB Central or from the Add-On Explorer in the MATLAB desktop.
DG: We know some users choose not to use an interactive environment like GUIDE or App Designer – they prefer to create their apps programmatically in MATLAB. You can continue to hand-code your apps regardless of which component set you use, whether it’s the older uicontrol function, or the newer component set we’ve been expanding since R2016a.
CP: Some of these users have used Java Swing to extend the capabilities of their apps including the use of the javacomponent function to add custom components. They needed to do this to integrate components we did not support like tabs, trees, and date pickers, and to customize components beyond what was documented, including richer cell level formatting for tables. Other have used the undocumented JavaFrame property to do things like maximize or minimize the figure window. And in a few cases, users have leveraged Java Swing directly in order to take advantage of things like Java layout managers to build IDE-like apps. App Designer gives us a foundation to address these long-standing gaps for our users. App Designer has been adding support for missing components and enhancing existing ones. We have a number of features lined up that will help bridge the Java Swing gap, and enable all of our MATLAB users to build more sophisticated apps.
DG: There are a couple of ways to do this. One is by using MATLAB Online. MATLAB Online lets you run MATLAB in a desktop web browser from any computer that has access to the internet. MATLAB Online is available with select licenses. Check your eligibility here. You create an app using the desktop version of MATLAB and save it to your MATLAB Drive. To run the app in a web browser, use your MathWorks account to log onto MATLAB Online at matlab.mathworks.com . You can use MATLAB Drive to easily share your app with anybody else who has access to MATLAB Online.
CP: The other way is to use MATLAB Compiler. In R2018a, MATLAB Compiler introduced a new feature that allows you to package App Designer apps as a web app. You create your app on the desktop, package it for the web using MATLAB Compiler, and copy the compiled app to a MATLAB web app server you’ve set up, which is also provided with MATLAB Compiler. This results in a URL that can be accessed in a web browser by anyone who has access to the server. The benefit is anyone can run the app in a browser, even if they aren’t MATLAB users. This approach is ideal for sharing apps on-premise, for co-workers to access via a web browser.
DG: We recommend users start with App Designer for all new apps unless the app needs to run in a version of MATLAB prior to R2016a. It is the platform we are continuously enhancing and expanding with each release. We also think many users will benefit from migrating their GUIDE apps to App Designer using the migration tool that Chris mentioned. Migration will give your app a more modern look and will make it possible to deploy your app to the Web.
CP: Users might consider continuing to use GUIDE for the following reasons:
- The migration tool highlights a limitation that is critical to the app’s workflow and cannot be worked around.
- The app needs to run in older releases of MATLAB that predate App Designer’s release in R2016a.
- The app relies on the use of undocumented Java functionality that is not supported in App Designer.
LS: Well, I think that's about it. Thank you both for sharing this valuable information with my readers.
Have you tried App Designer? Let us know here.
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.