Give title for Table
조회 수: 341(최근 30일)
표시 이전 댓글
Is it possible to give title for a table i have displayed as below
If i wanted to give a title 'My Table', how to give it?
Details = [38,71,176,124,93;...
43,69,163,109,77;...
38,64,131,125,83;...
40,67,133,117,75;...
49,64,119,122,80];
T = array2table(Details,...
'VariableNames',{'Age' 'Height' 'Weight' 'BP_High' 'BP_Low'},...
'RowNames',{'Smith';'Johnson';'Williams';'Jones';'Brown'});
disp(T)
댓글 수: 0
채택된 답변
Adam Danz
2021년 5월 3일
편집: Adam Danz
2021년 5월 3일
You could effectively give a title to a table by nesting the table within another single-column table that contains the title.
Details = [38,71,176,124,93;...
43,69,163,109,77;...
38,64,131,125,83;...
40,67,133,117,75;...
49,64,119,122,80];
T = array2table(Details,...
'VariableNames',{'Age' 'Height' 'Weight' 'BP_High' 'BP_Low'},...
'RowNames',{'Smith';'Johnson';'Williams';'Jones';'Brown'});
T = table(T,'VariableNames',{'My Table'}); % Nested table
disp(T)
However, now you'll have to index the table differently. For example, to access Height,
T.('My Table').Height
Or to access the 3rd row,
T.('My Table')(3,:)
or you could un-nest the table,
T = T.('My Table');
추가 답변(2개)
Abdul Kalam.A
2022년 6월 18일
if you want to display in command widow
fprintf(' your title')
tabulations = table(your parameters)
댓글 수: 1
Adam Danz
2022년 6월 21일
- Don't forget to add a newline (\n) after the fprintf string,
fprintf('your title\n')
2. The table that is printed by the table() command may be truncated if it is too wide or too tall. This is why it's better to use disp
Compare the following outputs:
T = table(rand(500,1), char(randi(26,500,3)+64))
disp(T)
참고 항목
범주
Find more on Tables 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!