Add a title to a table built with syntax - AUCtable = table(x, y, z)
7 ビュー (過去 30 日間)
古いコメントを表示
I have built a table
AUCtable = table(x, y, z)
how do I print it out 'nicely' -- without getting ans = lots of information type of syntax??
display(AUCtable) and AUCtable prints out
AUCtable
2 new lines
numRows x numCols table
2 new lines
then the table
I could probably live with that -- if I could add a title -- and AUCtable.Properties.Description ='My title' does not work
Thanks
0 件のコメント
採用された回答
Star Strider
2021 年 3 月 9 日
I am not exactly certain what you want as the end result.
Try this:
x = rand(5,1); % Create Vector
y = rand(5,1); % Create Vector
z = rand(5,1); % Create Vector
T1 = table(x,y,z); % Create Original Table
T2 = table(T1, 'VariableNames',{'My Title'}); % Create ‘Super Table’
get_x = T2.('My Title').x; % Retrieve Sample Data
producing:
T2 =
5×1 table
My Title
x y z
______________________________
0.25515 0.9368 0.00665
0.16694 0.77852 0.8626
0.19633 0.59893 0.011251
0.60822 0.5609 0.95496
0.59116 0.83691 0.97722
And of course:
disp(T2)
also works, producing simply:
My Title
x y z
_______________________________
0.053157 0.68624 0.20949
0.66566 0.39679 0.37425
0.5316 0.019607 0.31304
0.44307 0.53647 0.84004
0.28418 0.883 0.24669
.
7 件のコメント
Star Strider
2021 年 3 月 9 日
I am not certain what the problem is (or was). I submitted an enhancement request asking that (1) the six-column table displays as it should, with the title displayed above the variable names as it does with the three-column table, and (2) that adding the option of a table title would be an interesting addition.
So while ‘T2’ does not display as you (or I) would like it to (all six columns with their variable names),
get_x = T2.('My Title').x; % Retrieve Sample Data
continues to work correctly, so all is not lost.
This was an interesting problem!
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!