title to a table
이전 댓글 표시
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
채택된 답변
추가 답변 (2개)
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.
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
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
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.
카테고리
도움말 센터 및 File 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!