accessing table data in different forms
    4 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hi I have T table as follows.
LastName = {'Smith';'Johnson';'Williams';'Jones';'Brown'};
Age = [38;43;38;40;49];
FirstName = {'Amanda' ;'Brenda';'Carl'; 'Denis'; 'Ethan'};
Something = {'String1' ;'String2';'String2'; 'String1'; 'String5'};
Weight = [176;163;131;133;119];
FavoriteColor = {'blue' ;'red' ;'yellow'; 'orange' ;'colorblind' };
T = table(Age,FirstName,Weight,FavoriteColor,Something,'RowNames',LastName)
T.FavoriteColor= categorical(T.FavoriteColor);
T.Something= categorical(T.Something);
when I use
A=T(:,5);
I get a variable A which is a table as well. But when I use
A=T.Something;
I get a variable A which is a categorical value like the ones is column Something. I want to use loops so I need to use the first one with indices but I want the result in the second one. What should I do?
2 Commenti
  Geoff Hayes
      
      
 il 25 Ott 2014
				Ege - what are you trying to achieve? You mention that you want to use loops, but what do you want to use the loops for?
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Tables 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!

