Add a title to a table built with syntax - AUCtable = table(x, y, z)
    6 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposta accettata
  Star Strider
      
      
 il 9 Mar 2021
        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 Commenti
  Star Strider
      
      
 il 9 Mar 2021
				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!  
Più risposte (1)
Vedere anche
Categorie
				Scopri di più su Data Type Identification in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


