title to a table

26 visualizaciones (últimos 30 días)
gaia buratti
gaia buratti el 2 de Jul. de 2011
Movida: DGM el 14 de Mzo. de 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

Respuesta aceptada

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

Más respuestas (2)

Oleg Komarov
Oleg Komarov el 2 de Jul. de 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 comentario
gaia buratti
gaia buratti el 3 de Jul. de 2011
Movida: DGM el 14 de Mzo. de 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?

Iniciar sesión para comentar.


Matthew Nann
Matthew Nann el 3 de Nov. de 2019
Editada: Matthew Nann el 3 de Nov. de 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 comentarios
Deming Zhang
Deming Zhang el 13 de Mzo. de 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 el 13 de Mzo. de 2023
Editada: Deming Zhang el 13 de Mzo. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by