How to access column or a row in Table
91 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
balandong
le 1 Août 2017
Réponse apportée : Star Strider
le 1 Août 2017
How I can access the row or column in Matlab Table. Interestingly, Matlab allow you to access the content by using the traditional way which is using numerical value or by string.
For example, I have the following table. Then I am interested to extract the information from column BL, SS1, SS2, SS3, SS4. SS5, SS6, SS7, and SS8.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166455/image.jpeg)
So There is two ways
% Traditional way
ListPat = at.table.sixEarly(:,1:8);
Or by using something that maintain easy readability.
AccColumn = {'BL' 'SS1' 'SS2' 'SS3' 'SS4' 'SS5' ...
'SS6' 'SS7' 'SS8'};
ListPat = at.table.sixEarly(:,AccColumn);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166456/image.jpeg)
I prefer the second method because it ensure you know which column exactly you extract out. In addition, I think I read it somewhere, MATLAB will somewhere discontinue the DATASET type. You can read further about the Table here.
0 commentaires
Réponse acceptée
Star Strider
le 1 Août 2017
I am certain you have already read the documentation on Access Data in a Table (link) that defines several ways.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!