Indexing by using column names
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mia Dier
am 13 Sep. 2021
Kommentiert: Mia Dier
am 13 Sep. 2021
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 Kommentare
Akzeptierte Antwort
Chunru
am 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)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!