Indexing by using column names
34 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a table with column names A, B C. I want to create an array col_index=[1 0 1] by using the column names only.
0 commentaires
Réponse acceptée
Chunru
le 13 Sep 2021
A = zeros(3,1); B=rand(3,1); C=ones(3,1);
T = table(A, B, C)
VarNames = {'A', 'C'};
col_index = ismember(T.Properties.VariableNames, VarNames)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!