title to a table

22 views (last 30 days)
gaia buratti
gaia buratti on 2 Jul 2011
Moved: DGM on 14 Mar 2023
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

Accepted Answer

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

More Answers (2)

Oleg Komarov
Oleg Komarov on 2 Jul 2011
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 Comment
gaia buratti
gaia buratti on 3 Jul 2011
Moved: DGM on 14 Mar 2023
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?

Sign in to comment.


Matthew Nann
Matthew Nann on 3 Nov 2019
Edited: Matthew Nann on 3 Nov 2019
%% 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 Comments
Deming Zhang
Deming Zhang on 13 Mar 2023
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 on 13 Mar 2023
Edited: Deming Zhang on 13 Mar 2023
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.

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer 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!