How to save UIFIGURE or UITABLE as a jpg?
54 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Walter Roberson
2020-4-6
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
2022-7-17
hey william,
went down this rabbit hole as well.
exportapp() seems to work for me, hope it helps for you too 🙏🏽
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!