Update figure-Based Apps to Use uifigure - MATLAB & Simulink (2025)

Update figure-Based Apps to Use uifigure

MATLAB® provides two functions to create a figure window: figure and uifigure. While both of these functions create a Figure object, there are some differences in the way that this object is configured and the capabilities it supports. Figures created using the uifigure function are configured primarily for app building, whereas figures created using the figure function are configured primarily for data exploration and visualization.

The uifigure function is the recommended function to use when building new apps programmatically, and is the function that App Designer uses to create apps. The figure function will continue to be supported, but there are many new app building capabilities that can be used only with UI figures. This page provides an overview of the differences between Figure objects created using the figure function and the uifigure function, and information about how to update your app to take advantage of the uifigure-based app building capabilities.

Overview for Updating Your App

To update your figure-based app to use uifigure and take advantage of the additional capabilities in UI figures, follow these steps:

  1. Update App Figure and Containers — Replace calls to figure with uifigure, and update the properties of the Figure object and other app containers, such as Panel and TabGroup objects.

  2. Update UIControl Objects and Callbacks — Replace calls to uicontrol with analogous UI component functions, and update component properties and callbacks.

  3. Update Dialog Boxes — Replace calls to dialog box functions such as errordlg and warndlg with dialog box functions configured for app building such as uialert.

Capabilities Only Available with UI Figures

Some benefits of updating your app to use the uifigure function include:

  • Additional component types — UI figures support additional modern app building components, such as:

  • Modern layout and resize options — UI figures support grid layout managers and component auto-resize behavior as an alternative to manually specifying the Position property and writing resize code in a SizeChangedFcn callback. Using these alternatives can greatly simplify app layout code.

  • Additional capabilities for existing components — Components in UI figures support additional customization options, including:

    • Making containers scrollable

    • Styling individual table cells to change the color and font, and to add icons and format text

    • Displaying table array data in table UI components

To see a list of all components supported in uifigure-based apps, see App Building Components.

Differences Between figure-Based and uifigure-Based Apps

The major differences between figure-based apps and uifigure-based apps are due to differences in the underlying Figure object configuration and unsupported functionality. Understanding these differences will help you update your figure-based app to use uifigure.

Differences in Default Configuration

Because figures created using the uifigure function are configured for app building instead of data exploration, there are some differences in the default configuration of those Figure objects when compared to figures created using the figure function. This table lists the major differences.

Categoryfigure Configurationuifigure ConfigurationExplanation of Difference
Menu and toolbarThe figure window has a default menu and toolbar with common data exploration functionality.The UI figure window does not have a default menu and toolbar.The functionality that the menu and toolbar provide is less relevant for app building than for data exploration. You can create your own custom menu and toolbar for the apps you create by using the uimenu and uitoolbar functions.
HandleVisibility valueThe HandleVisibility of the figure is 'on' by default.The HandleVisibility of the UI figure is 'off' by default.The value of the HandleVisibility property controls whether the figure or the objects it contains can become the current object (for example, using gcf or gca). Many graphics functions implicitly use gcf or gca to determine the target for operations such as plotting data. The HandleVisibility of a UI figure is 'off' by default so that functions do not make unwanted changes to the user interface.
Resize behaviorResizing the figure window has no effect on the size of controls and containers such as UIControl, Table, and Panel objects by default.The UI figure has a property named AutoResizeChildren that is set to 'on' by default. When AutoResizeChildren is 'on', MATLAB automatically resizes objects in the UI figure window whenever the UI figure window is resized. You can set AutoResizeChildren to 'off' to disable this resize behavior.Resizing UI components when a user resizes a UI figure window enables app use at any window size. The auto-resize behavior in UI figures provides a lightweight default behavior in addition to other resize management options such as grid layout managers.
Container location, size, and unitsBy default, Panel, ButtonGroup, and TabGroup objects parented to the figure have Units set to 'normalized' and occupy the full size of the figure window.All containers and UI components parented to the UI figure have a set default location and size, specified in pixel units.Using pixel units to manually specify the position of containers and UI components provides the most control over your app layout. If you want to automatically resize containers or components based on the size of their parent in a UI figure, create a grid layout manager using the uigridlayout function.

Unsupported Functionality in UI Figures

Some functionality that is supported in figures created using the figure function is not supported in figures created using the uifigure function. This table lists common scenarios and coding patterns that require extra steps or manual code changes when updating your apps to use uifigure.

CategoryNot SupportedSuggested Actions
Controls created using uicontrolUser interface controls created using the uicontrol function are not supported in figures created using the uifigure function.

Update your app to use supported UI components. For example, use the uibutton function to create a push button.

For more information, see Update UIControl Objects and Callbacks.

Menu and toolbarFigures created using the uifigure function do not have the option to specify MenuBar and ToolBar properties.Recreate the relevant behavior or design your own custom menu and toolbar by using the uimenu and uitoolbar functions.
Container border properties

Certain options for configuring Panel and ButtonGroup objects are available only when the object is parented to a figure created using the figure function:

  • Specifying the BorderType property as 'etchedin', 'etchedout', 'beveledin', or 'beveledout'

  • Specifying the ShadowColor property

  • Specifying the TitlePosition property as 'leftbottom', 'centerbottom', or 'rightbottom'

Determine if this functionality is critical to your app before updating your app to use uifigure. Consider customizing container borders using supported properties, such as BorderColor and BorderWidth.
Modal dialog boxesThe 'modal' option for errordlg, warndlg, helpdlg, msgbox, and waitbar has no effect when the dialog box is created for a uifigure-based app.

Replace calls to these functions with dialog box functions such as uialert, uiconfirm, and uiprogressdlg. These dialog boxes are created for use in uifigure-based apps and support modal options.

For more information, see Update Dialog Boxes.

Related Topics

  • Update App Figure and Containers
  • Update UIControl Objects and Callbacks
  • Update Dialog Boxes
Update figure-Based Apps to Use uifigure
- MATLAB & Simulink (2025)

FAQs

How to update MATLAB and Simulink? ›

On the Home tab, click Help > Check for Updates. The Add-On Manager opens with the Updates tab selected. If there is an update available for your version of MATLAB, click the Update button to the right of the update name to install it.

What is the Uifigure function in MATLAB? ›

The uifigure function creates a figure that is specially configured for app building and serves as the container for your user interface. UI figures support the same types of modern graphics and interactive UI components that App Designer supports.

What is the difference between figure and Uifigure in MATLAB? ›

Figures created using the uifigure function are configured primarily for app building, whereas figures created using the figure function are configured primarily for data exploration and visualization.

How to use Simulink in MATLAB mobile app? ›

Add Simulink Scope to App
  1. Create a Simulink model.
  2. Open the Simulink Library Browser. ...
  3. From the Simulink > Sinks library, add a Scope block to your model.
  4. In the model, connect the Sine Wave block to the Scope block.
  5. In the Sine Wave block, set the Sine type to Sample based and Sample time to 1 . ...
  6. In the model, click Run.

What is Simulink used for? ›

Simulink is the platform for Model-Based Design that supports system-level design, simulation, automatic code generation, and continuous test and verification of embedded systems. Key capabilities include: A graphical editor for modeling all components of a system.

What is update diagram in Simulink? ›

Before every simulation and when the user requests it, Simulink performs an 'Update Diagram' (Ctrl-D) to ready the model for simulation. During the update process, Simulink does the following: 1. Evaluates the model's block parameter expressions to determine their values. 2.

How to use UIfigure? ›

Example: uifigure(Name="My App") specifies My App as the title of the UI figure. Before R2021a, use commas to separate each name and value, and enclose Name in quotes. Example: uifigure("Name","My App") specifies My App as the title of the UI figure. The properties listed here are a subset of the available properties.

How do I make MATLAB Uifigure full screen? ›

Pressing Ctrl+F11 (Windows® and Linux®) or Ctrl+Command+F (macOS) toggles the 'fullscreen' state. Setting this property on a docked figure or in MATLAB Online™ is not supported. UI figures cannot be minimized directly from a full screen state.

Why figure function is used in MATLAB? ›

figure creates figure graphics objects. figure objects are the individual windows on the screen in which MATLAB displays graphical output. figure creates a new figure object using default property values.

How do I edit a figure in MATLAB? ›

  1. To add a title, go to the Figure tab, and select Title. ...
  2. To add axes labels, go to the Figure tab, and select X-Label. ...
  3. To add a legend, go to the Figure tab, and select Legend. ...
  4. To add grid lines, go to the Figure tab, and select Grid. ...
  5. To update the code, in the selected figure, click the Update Code button.

How to extract data from a figure in MATLAB? ›

Direct link to this question
  1. open('2.fig');
  2. h = gcf; %current figure handle.
  3. axesObjs = get(h, 'Children'); %axes handles.
  4. dataObjs = get(axesObjs, 'Children'); %handles t.
  5. xdata = get(dataObjs, 'XData');
  6. ydata = get(dataObjs, 'YData');
Jan 30, 2019

How does MATLAB and Simulink work? ›

Simulink provides a graphical editor, customizable block libraries, and solvers for modeling and simulating dynamic systems. It is integrated with MATLAB®, enabling you to incorporate MATLAB algorithms into models and export simulation results to MATLAB for further analysis.

Can I use MATLAB Simulink online? ›

Simulink® Online™ provides access to Simulink from any standard web browser wherever you have internet access. Simply sign in to MATLAB® Online™ and either start Simulink or open an existing Simulink model. Simulink Online is ideal for teaching, learning, and convenient, lightweight access.

How to run Simulink model from MATLAB? ›

When you want to simulate the model using the current values for all model configuration parameter values, block parameter values, variable values, and so on, use the most basic syntax, specifying only the name of the model as an input argument. out = sim("ModelName"); This syntax returns a single Simulink.

How do I refresh Simulink? ›

Select a Model block. In the Simulink® Toolstrip, on the Model Block tab, click Refresh .

How to update MATLAB from terminal? ›

Install MATLAB Update on Offline Computer
  1. From the Windows command line, navigate to this folder: cd matlabInstallFolder /bin/ arch. ...
  2. Run the update installer with the updatepackage option. Specify the full path to the folder where you unzipped the update package, updatePackageFolder .

How to add Simulink to existing MATLAB? ›

To find and install add-ons, go to the Home tab, and in the Environment section, click the Add-Ons icon. The Add-On Explorer opens and displays the list of available add-ons. You must have an active internet connection to get add-ons using the Add-On Explorer.

How to check Simulink version in MATLAB? ›

In MATLAB, navigate to the folder where the model is saved. Select the model (under current folder) and select 'Show Details' . A pop up window on the bottom left will show you a preview of the model along with Model Version, Saved in Simulink version, Last Modified by .

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 6309

Rating: 4.1 / 5 (62 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.