Check for column in table
48 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How do I search whether a column, lets say 'Column1', exists in a table, Table_1, without using strmatch as it is not recommended.
0 commentaires
Réponses (2)
Kevin Phung
le 10 Juil 2019
Modifié(e) : Kevin Phung
le 10 Juil 2019
any(ismember(Table_1.Properties.VariableNames,'Column1'))
strcmp works too, in place of ismember
0 commentaires
Shubham Sangle
le 10 Juil 2019
Similar questions with accepted answer is available at https://in.mathworks.com/matlabcentral/answers/313776-how-to-check-whether-a-column-exist-in-a-table
Exist_Column = strcmp('My_Column',My_Table.Properties.VariableNames)
val = Exist_Column(Exist_Column==1) ;
0 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!