フィルターのクリア

Show filtered column of a cell array based on filtered cell header

3 ビュー (過去 30 日間)
joms
joms 2020 年 11 月 25 日
コメント済み: joms 2020 年 11 月 25 日
I want to show filtered column of a cell array based the header .Im using matlab 2016b
For example i have cell data such as the following. 1st row is the column title that i intend to show as a list item.
data= {'A' ,'B' ,'C';'1', '2', '3';'1' ,'2', '3';'1', '2', '3'}
If user selects A & B
selected={'A' 'B'}
the UItable will show only 1st nd 3rd column only
this should be the result:
showedcolumn= {'A' ,'C';'1', '3';'1' ,'3'' 1', '3'}

採用された回答

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 25 日
編集済み: Setsuna Yuuki. 2020 年 11 月 25 日
Hi :D
data= {'A' ,'B' ,'C';'1', '2', '3';'1' ,'2', '3';'1', '2', '3'};
fprintf("input with a space \n") %Example: a b or a c or a b c
x = string(input("",'s'));
x = upper(strsplit(x));
a = contains(data,x);
a = a(1,1:3);
k = find(~a)
t = cell2table(data);
t.Properties.VariableNames = ({'A','B','C'});
t = removevars(t,k)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScope Variables and Generate Names についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by