How to save UIFIGURE or UITABLE as a jpg?
34 views (last 30 days)
Show older comments
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.
0 Comments
Answers (2)
Walter Roberson
on 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.)
Joseph Cin
on 17 Jul 2022
hey william,
went down this rabbit hole as well.
exportapp() seems to work for me, hope it helps for you too 🙏🏽
0 Comments
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!