How can I find an uifigure? (2024)

61 views (last 30 days)

Show older comments

Clovis Bonavides on 25 Jan 2020

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure

Commented: Adam Danz on 28 Jan 2020

Accepted Answer: Adam Danz

I am mixing some old GUIs designed with GUIDE with uifigures, so I can use the uitree object (and some others).

However, when I try to establish communication between some functions in my GUIs (need to click on an ax and then assign some value from a tree node and insert into a table) I cannot find the uifigure - neither using "findobj ('Type', 'figure')" nor using "findall (groot)". Before I started this design I did not even consider this possibility, thought it would be something quite simple - which it probably is but I cannot get past this point.

Would really appreciate any answer or a possible solution to this issue.

6 Comments

Show 4 older commentsHide 4 older comments

Allen on 25 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_789941

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_789941

Open in MATLAB Online

I am able to create a figure using uifigure and then find the handle using findall(groot) using R2019b. Have you tried assigning a name to the figure during creation? If not, it might be worth a try to see if you are not locating it simply because it is hard to identify amoung a list of Figures when using findall.

uifigure('Name','YourFigureName')

Clovis Bonavides on 26 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790028

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790028

Thanks to everyone for your hep. However the problem is more complicated - I had already tried searching with both Type, Tag, etc. I forgot to mention about the handle visibility (see Walter‘s answer) but it cannot be set to ON if - almost unbelievable! - the uifigure was created using the uifigure function, which is here the case. I am expecting an answer from Mathworks about this case.

Adam Danz on 26 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790030

Have you tried findall without the tag? That should work with uifigures / appdesigner.

Walter Roberson on 26 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790033

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790033

Open in MATLAB Online

I had no problem using

H = uifigure('handlevisibility', 'on')

when I tested.

Clovis Bonavides on 26 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790104

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790104

Walter - thanks! But I get this err msg:

" Error using appwindowfactory

Functionality not supported with figures created with the uifigure function. For more information, see

Graphics Support in App Designer. "

Problem is that right now I must use figures as I am adapting some existing code and must try to avoid opening a new window as much as possible. Cannot use the appdesigner in this case without adding some substantial amount of work...

Adam Danz on 26 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790145

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790145

Edited: Adam Danz on 26 Jan 2020

In r2019b the handlevisibility property of uifigures can only be set to off.

https://www.mathworks.com/help/matlab/ref/matlab.ui.figureappd-properties.html#bu4i700-1-HandleVisibility

When it's set to "on" you get a "functionality not supported" error. Maybe that will change in 2020a.

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Adam Danz on 26 Jan 2020

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412040

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412040

Edited: Adam Danz on 27 Jan 2020

Open in MATLAB Online

You can find the uifigure handle using findall() but it's not recommended to merely find handles to all figures because it's quite likely that at some point other figures will exist other than your GUI.

To find the handle to your GUI figure, add a long, descriptive, unique name to the tag property of your GUI. Then specify that unique tag name when searching for the GUI handle.

uif = uifigure('Tag','MyUniqueTag'); % a demo ui-figure with a unique tag name

h = findall(0,'Type','figure','tag','MyUniqueTag') % Get the handle.

To search for all figures (hidden or not)

h = findall(0,'Type','figure');

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

More Answers (2)

Walter Roberson on 26 Jan 2020

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412047

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412047

Open in MATLAB Online

If you create the uifigure with HandleVisibility, 'on', then you can

findobj(groot, 'type', 'figure')

otherwise you need findall() because the handle visibility for uifigure defaults to 'off'

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Clovis Bonavides on 28 Jan 2020

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412476

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#answer_412476

None of the solutions proposed up to this point does work. The visibility of the uifigure created programmatically cannot be set to ON - which is probably a bug. Hopefully this will be fixed in the next coming version. Anyway, many thanks to all those who tried to help me. I actually got around by working creating a new window with the uifigure (tree), something I much wanted to avoid.

3 Comments

Show 1 older commentHide 1 older comment

Adam Danz on 28 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790938

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790938

Edited: Adam Danz on 28 Jan 2020

Open in MATLAB Online

My answer absolutely works in r2019b (the release you're using).

% Create a UIFigure

uif = uifigure('Name','ThisWorks!');

% Find handles to all figures

h = findall(0,'Type','figure')

Result

h =

Figure (ThisWorks!) with properties:

Number: []

Name: 'ThisWorks!'

Color: [0.9400 0.9400 0.9400]

Position: [508 656 583 437]

Units: 'pixels'

Show all properties

If it doesn't work for you then something else is wrong.

Adam Danz on 28 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790978

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790978

Edited: Adam Danz on 28 Jan 2020

Clovis Bonavides's answer moved here as a comment

Adam, you are absolutely correct. It DOES work in vers 2019.b, which I just got loaded.

In vers 2018b it doesn't work as the uifigure's handle visibility is "hardwired" to "OFF" and cannot be changed through the uifigure generation code.

Thanks!

Adam Danz on 28 Jan 2020

Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790982

  • Link

    Direct link to this comment

    https://www.mathworks.com/matlabcentral/answers/501966-how-can-i-find-an-uifigure#comment_790982

On the right hand column of this page you can see the Product and Release fields where you entered r2019b. This is very helpful info and most people don't fill it out (so, thank you!).

BTW, I just tested the lines in my comment above in r2018b and it also works there, too. Maybe something was copied wrong when you were trying it out.

Sign in to comment.

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

  • find uifigure findobj uitree findall

Products

  • MATLAB

Release

R2019b

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.


How can I find an uifigure? (14)

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

How can I find an uifigure? (2024)
Top Articles
Pink Kush Weed Strain Information | Leafly
Craigslist Stowe Vermont
Busted Newspaper Zapata Tx
Best Team In 2K23 Myteam
The 10 Best Restaurants In Freiburg Germany
Voorraad - Foodtrailers
Brendon Tyler Wharton Height
Vaya Timeclock
Fully Enclosed IP20 Interface Modules To Ensure Safety In Industrial Environment
How to change your Android phone's default Google account
Craigslist Free Stuff Appleton Wisconsin
When is streaming illegal? What you need to know about pirated content
Green Bay Press Gazette Obituary
Chuckwagon racing 101: why it's OK to ask what a wheeler is | CBC News
Self-guided tour (for students) – Teaching & Learning Support
J Prince Steps Over Takeoff
Whiskeytown Camera
FIX: Spacebar, Enter, or Backspace Not Working
Explore Top Free Tattoo Fonts: Style Your Ink Perfectly! 🖌️
Bahsid Mclean Uncensored Photo
Cashtapp Atm Near Me
SXSW Film & TV Alumni Releases – July & August 2024
The Cure Average Setlist
Niche Crime Rate
10 Fun Things to Do in Elk Grove, CA | Explore Elk Grove
Earl David Worden Military Service
Craigslist Maui Garage Sale
Dallas Craigslist Org Dallas
Marion City Wide Garage Sale 2023
Sandals Travel Agent Login
14 Top-Rated Attractions & Things to Do in Medford, OR
UCLA Study Abroad | International Education Office
Obituaries, 2001 | El Paso County, TXGenWeb
Healthy Kaiserpermanente Org Sign On
Spirited Showtimes Near Marcus Twin Creek Cinema
Chadrad Swap Shop
Stolen Touches Neva Altaj Read Online Free
Marine Forecast Sandy Hook To Manasquan Inlet
Toonily The Carry
How to Draw a Sailboat: 7 Steps (with Pictures) - wikiHow
Why I’m Joining Flipboard
World Social Protection Report 2024-26: Universal social protection for climate action and a just transition
Dwc Qme Database
Rage Of Harrogath Bugged
Pulaski County Ky Mugshots Busted Newspaper
Watch Chainsaw Man English Sub/Dub online Free on HiAnime.to
Best Haircut Shop Near Me
Dyi Urban Dictionary
Www Pig11 Net
Egg Inc Wiki
About us | DELTA Fiber
Guidance | GreenStar™ 3 2630 Display
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6261

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.