フィルターのクリア

Finding columns by name in a cell array

2 ビュー (過去 30 日間)
012786534
012786534 2017 年 4 月 12 日
編集済み: Stephen23 2017 年 4 月 12 日
Hello all,
Let's say I have a large cell array with similar variable names in the first row (A_F1 , B_F2 , A_F2 , G_F5 ...) followed by data.
I want to create a smaller cell array with just the columns where the variable name starts with A_ AND the one column right before each of those variables. Something based on this (thanks Stephen Cobeldick!):
idx = strncmp(QC(1,:),'A_',2); %Find the columns that start with A_
? %Find the columns right before those that start with A_
Q = QC(:,idx); %Produce the new cell array
How would I do that?
Thank you

採用された回答

Stephen23
Stephen23 2017 年 4 月 12 日
編集済み: Stephen23 2017 年 4 月 12 日
idx = strncmp(QC(1,:),'A_',2);
idx = idx | [idx(2:end),false];
Q = QC(:,idx);

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by