title to a table

20 次查看(过去 30 天)
gaia buratti
gaia buratti 2011-7-2
移动DGM 2023-3-14
Hi, I know my question is stupid, but i don't know really well the Matlab function relating to table and graphs and I cannot find it. I need to put title to the table I built using uitable. I tried with title('Title') but it also draw an empty graph under the table and it's not very nice.
may someone help me? Thanks Gaia

采纳的回答

Paulo Silva
Paulo Silva 2011-7-3
uitables don't have titles, what you can do is put one static text box above your uitable.

更多回答(2 个)

Oleg Komarov
Oleg Komarov 2011-7-2
After you created the uitable (or when declaring the figure):
set(cgf,'Name','myName')
set(gcf,'Name','myName','NumberTitle','off') % To keep only your title.
  1 个评论
gaia buratti
gaia buratti 2011-7-3
移动:DGM 2023-3-14
I tried, this put the name in the figure, I mean in the window, but can I add a tutle to the table in a way that if I copy and paste I can see it?

请先登录,再进行评论。


Matthew Nann
Matthew Nann 2019-11-3
编辑:Matthew Nann 2019-11-3
%% nested function:
function createTable(data, titleName)
%creating only one figure for both simulations
if graph == 1
f = figure(2);
end
f = figure(2);
%creating a subplot to add a title then remove the axis's labels
subplot(2,1,graph)
set(gca,'YTickLabel',[]);
set(gca,'XTickLabel',[]);
title(titleName);
rnames = {};
cnames = {};
tableData = [];
%creating table to place over plot containing the bounces and peaks data
t = uitable(f,'Data',tableData,...
'ColumnName',cnames,...
'RowName',rnames,...
'ColumnWidth',{100});
pos = get(subplot(2,1,graph),'position');
set(t,'units','normalized')
set(t,'position',pos)
end
I used this function to create a table in one of my assignments. Create a plot add the title and remove the axis ticks and labels, then get the position of the plot and add in the uitable. The uitable will be essentially on top of the plot but the title will remain.
  2 个评论
Deming Zhang
Deming Zhang 2023-3-13
Thanks for sharing this idea. I had costed lots of time to try to find a way to add a title to a table, but not got satisfied methods.
I hope Matlab can provide an easy way to add a title to a table, acctually, just add a title property to a table for plotting out. For wrting essay or documentation of batch data processing, people otfen need to print out tables with proper titles automatically. It is worth for Matlab to provide this function or ability.
Deming Zhang
Deming Zhang 2023-3-13
编辑:Deming Zhang 2023-3-13
Thanks for sharing this idea. I had costed lots of time to try to find a way to add a title to a table, but not got satisfied methods.
I hope Matlab can provide an easy way to add a title to an uitable, acctually, just add a title property to a table for plotting out. For wrting essay or documentation of batch data processing, people often need to print out uitables with proper titles automatically. It is worth for Matlab to provide this function or ability.
I might use uifigure() instead of figure() function, but it looks in uifigure() there is no easy way to copy the figure into your document. With figure() it is very easy to use the build-in menu "Copy Figure" and paste it to your document.
So, I also hope Matlab may provide the menu bar in uifigure() for people to easily copy the figure. The user may have their freedom to choose to disable/enable the menu bar.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by