How to save UIFIGURE or UITABLE as a jpg?

45 Ansichten (letzte 30 Tage)
William Beverley
William Beverley am 6 Apr. 2020
Beantwortet: Joseph Cin am 17 Jul. 2022
Hi,
I know this has been addressed before but none of the solutions works.
I want to create a nice looking (colours etc.) table in Matlab that I can automatedly save out to the filesystem as a gif or jpg.
Unfortunately this is turning out to be bizarrely difficult.
I know that a figure can easily be saved out with the saveas command and I have this working. I also have played around with export_fig.
However, mathworks are recommending using uitable to create tables and it seems uitable cannot (anymore) be added to a figure but must be added to uifigure.
The problem then is that uifigure (or uitable) both seem to be unsavable!
If I have a uitable on uifigure, can anyone advise what commands will save that figure as a jpg or better still just the uitable?
Thanks in advance.

Antworten (2)

Walter Roberson
Walter Roberson am 6 Apr. 2020
it seems uitable cannot (anymore) be added to a figure but must be added to uifigure
That is not correct.
uit = uitable(figure(), 'data', {1;2;3})
worked fine.
I want to create a nice looking (colours etc.) table in Matlab
The new facilities to color cells for tables only work for uitables() that are part of uifigure(), and not for traditional figure. For traditional figures to color cells, you had to use HTML 1.1 codes inside the cell, like '<HTML><bgcolor="red">hello' . This was always a pain.
If I have a uitable on uifigure, can anyone advise what commands will save that figure as a jpg or better still just the uitable?
As far as we have been able to tell recently, you cannot do that except by using screen capture (and I do not mean getframe(), I mean something provided by your operating system or another application.)
  1 Kommentar
William Beverley
William Beverley am 6 Apr. 2020
Thanks for the quick response.
I see now that a uitable can be created on a figure - I just hadn't realized that you can't create a uitable with a table as data, but have provide a cell array (unlike when adding a uitable to uifigure (!)
I expect I am missing something but it seems strange that one cannot save out or export enhanced tables (or even raw tables) as graphic objects for use elsewhere, e.g. presentations in powerpoint. Surely that's one of the whole points of graphical tables (just like plots etc.)?
In meantime, I'll return to using Excel for this one..!
Thanks again.

Melden Sie sich an, um zu kommentieren.


Joseph Cin
Joseph Cin am 17 Jul. 2022
hey william,
went down this rabbit hole as well.
exportapp() seems to work for me, hope it helps for you too 🙏🏽

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by