フィルターのクリア

Indexing by using column names

18 ビュー (過去 30 日間)
Mia Dier
Mia Dier 2021 年 9 月 13 日
コメント済み: Mia Dier 2021 年 9 月 13 日
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.

採用された回答

Chunru
Chunru 2021 年 9 月 13 日
A = zeros(3,1); B=rand(3,1); C=ones(3,1);
T = table(A, B, C)
T = 3×3 table
A B C _ ________ _ 0 0.10002 1 0 0.034853 1 0 0.06117 1
VarNames = {'A', 'C'};
col_index = ismember(T.Properties.VariableNames, VarNames)
col_index = 1×3 logical array
1 0 1
  1 件のコメント
Mia Dier
Mia Dier 2021 年 9 月 13 日
Thank you!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by