What Is a MATLAB GUI?
Graphical user interfaces (GUIs), also known as apps, provide point-and-click control of your software applications, eliminating the need for others to learn a language or type commands in order to run the application. You can share apps both for use within MATLAB and also as standalone desktop or web apps.
You can choose from the following three ways to create an app in MATLAB:
- Convert a script into a simple app: Choose this option when you want to share a script with students or colleagues and allow them to modify variables using interactive controls.
- Create an app interactively: Choose this option when you want to create a more sophisticated app using a drag-and-drop environment to build the user interface.
- Create an app programmatically: Choose this option when you want to create an app’s user interface by writing the code yourself.
Convert a Script into a Simple App
Use the Live Editor to convert a script into a simple app that has interactive controls allowing others to experiment with variables in your code. Add sliders, dropdowns, edit fields, and buttons without writing any code. Specify what parts of the script will run when a value is changed. Hide the code to create simple apps and dashboards.
You can share your live script with others to use in MATLAB or MATLAB Online.
Interactive controls are good for creating an easy interface to a live script. If you want to design a more sophisticated user interface or want more control over the app’s behavior, you should consider building a standalone app using App Designer.
Create an App Interactively
App Designer is an interactive environment that integrates the two primary tasks of app building: laying out the visual components and programming the app’s behavior. It allows you to quickly move between visual design in the canvas and developing code in the MATLAB editor.
You can share your app with others to use in MATLAB on the desktop or in a web browser using MATLAB Online. App Designer apps can also be packaged for installation into the MATLAB Apps tab. To share with non-MATLAB users, you can compile apps into standalone desktop and web apps using MATLAB Compiler.
App Designer is good for interactively designing your layout and programming its behavior in one environment. If you prefer, you can program the entire app yourself, including the user interface.
Create an App Programmatically
For added control over design and development, you can also use MATLAB functions to define the layout and behavior of your app. In this approach, you create a figure to serve as the container for your user interface and add components to it programmatically.
You can share your app with others to use in MATLAB on the desktop or in a web browser using MATLAB Online. Apps can also be packaged for installation into the MATLAB Apps tab. To share with non-MATLAB users, you can compile your apps into standalone desktop apps using MATLAB Compiler.