uifigure vs figure - advice please (2024)

92 views (last 30 days)

Show older comments

Justin on 8 Feb 2021

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please

Edited: Adam Danz on 9 Feb 2021

We have a set of Matlab-based tools that all use a common set of GUI superclasses to provide a consistent look and feel plus certain common functionality. They pre-date uifigure so use figure to create the GUIs. There are some features that are only available in GUIs created using uifigure, e.g. scrollable panels, plus the compatibility with the App Designer.

As a test I changed our superclass to use uifigure and encountered a pile of warnings and errors when testing with one of our tools. Obviously I can work through those but expect I will find the same in our other tools using the same GUI superclasses.

So, my questions are:

1) Is there a guide specifically for converting figure-based GUIs to uifigure-based? A checklist of what properties/methods are different even. I couldn't find anything.

2) Any experience/comments on how much pain is involved? If it was just one tool I'd go for it but it's a suite of tools in our case.

5 Comments

Show 3 older commentsHide 3 older comments

Walter Roberson on 8 Feb 2021

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314492

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314492

https://www.mathworks.com/matlabcentral/fileexchange/66087-guide-to-app-designer-migration-tool-for-matlab

Justin on 8 Feb 2021

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314512

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314512

Edited: Justin on 8 Feb 2021

Thanks, there is some useful info there, although it is for GUIs created with GUIDE rather than created programatically.

Mario Malic on 8 Feb 2021

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314582

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1314582

This will be hard to answer for any of us, especially since you're talking about your own, specific class that you use to create GUIs. You can open uifigure and figure properties documentation side by side, you'll see that most of the properties are the different, also, how callbacks are written is different (I am not completely sure about this one, as I didn't write any for figure). Secondly, there might be an issue with the components that support figure but not uifigure. This doesn't seem like an easy task to do.

Justin on 9 Feb 2021

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1317702

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1317702

I wasn't expecting a definitive answer so your thoughts were appreciated. It didn't seem trivial to me either and it was useful to have that confirmed.

It turned out that implementing a custom scrollable uitab in my existing figure-based GUI wasn't so difficult, so I've done that for now.

Will look to move over to uifigure at a later date as no doubt its native scrollable containers will be better than mine.

Adam Danz on 9 Feb 2021

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1317762

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/739217-uifigure-vs-figure-advice-please#comment_1317762

Edited: Adam Danz on 9 Feb 2021

My $0.02 on this in a recent similar question: [here].

One of the biggest differences is the HandleVisibility between uifigure ('off') and regular figures ('on') which requires using parent handles when adding anything to the figure but this is a good habbit to get into, anyway.

UIaxes (and uifgures) are still a bit slower to render than regular axes/figure [see this comparison from r2019b]. That comparison includes a lot of overhead in appdesigner but the difference still exists outside of appdesigner.

As you mentioned, there are a lot of nice features designed for uifigures and if you plan on using those features, it may be tipping point to your decision. If you're not planning on using those features, I see no reason to make the switch.

Sign in to comment.

Sign in to answer this question.

Answers (0)

Sign in to answer this question.

See Also

Categories

MATLABApp BuildingDevelop Apps ProgrammaticallyDevelop uifigure-Based Apps

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Tags

  • uifigure
  • matlab

Products

  • MATLAB

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


uifigure vs figure - advice please (7)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

uifigure vs figure - advice please (2024)

FAQs

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.

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.

How to name a figure in Matlab? ›

Name — Name

Example: figure('Name','Results') sets the name of the figure to 'Results' . By default, the name is 'Figure n' , where n is an integer.

Why do we use figure 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.

What is the difference between figure and subplot? ›

Axes can be put in any position on the figure using the add_axes([left, bottom, width, height]) function. Subplots are groups of axes that can exist in a single matplotlib figure. Subplots are a way to organize the axes into a fixed grid.

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.

What does Normpdf do in MATLAB? ›

Description. y = normpdf( x ) returns the probability density function (pdf) of the standard normal distribution, evaluated at the values in x .

How do you properly name figures? ›

Figures should be:

Labeled (under the figure) with the figure number and appropriate descriptive title (“Figure” can be spelled out [“Figure 1.”] or abbreviated [“Fig. 1.”] as long as you are consistent). Numbered in the order they appear in the text.

How do you call a current figure in MATLAB? ›

Use the gcf command to get the current figure handle. surf(peaks) fig = gcf; % current figure handle fig.

How do you write on a figure in MATLAB? ›

Add text anywhere within the figure using the annotation function instead of the text function. The first input argument specifies the type of annotation. The second input argument specifies the position of the annotation in units normalized to the figure.

What is subplot and figure in MATLAB? ›

subplot( m , n , p ) divides the current figure into an m -by- n grid and creates axes in the position specified by p . MATLAB® numbers subplot positions by row. The first subplot is the first column of the first row, the second subplot is the second column of the first row, and so on.

What is a figure handle in MATLAB? ›

It is the second highest level object you can create. To create a figure, use the figure function like so: >> fhandle = figure; This creates a new figure window and stores all the figure data in the variable fhandle.

What is the difference between symbolic and numeric in MATLAB? ›

In numeric arithmetic, you represent numbers in floating-point format using either double precision or variable precision. In symbolic arithmetic, you represent numbers in their exact form.

What is the difference between reshape and resize in MATLAB? ›

The difference between them is that the reshape() does not changes the original array but only returns the changed array, whereas the resize() method returns nothing and directly changes the original array.

Top Articles
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 5820

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.