How do i Filter out table columns headers based on given query words?
5 次查看(过去 30 天)
显示 更早的评论
Dear Experiences
i have a table that look like the following:
Table:
Name RC BV CC RQ CY ..... TY
A1 1 0 1 0 1 0
A2 1 0 0 0 0 0
A3 0 1 1 0 1 0
A4 0 0 0 0 0 1
then for the given query word such as ( A1 ) then the result perhaps store in cell array like:
Result ={ RC , CC , CY ,...} where the values of A1 in the corresponding columns header are 1.
i would thanks any one can give me help.
0 个评论
采纳的回答
Walter Roberson
2017-8-19
YourTable.Properties.VariableNames( logical(YourTable{1,:}) )
1 个评论
Peter Perkins
2017-8-23
You could also make Name the row names, i which case Walter's answer looks like
YourTable.Properties.VariableNames( logical(YourTable{'A1',:}) )
更多回答(1 个)
KL
2017-8-19
x = rand(3,3);
rowX = {'A1','A2','A3'};
xT = array2table(x,'RowNames',rowX)
xA1 = table2cell(xT({'A1'},:))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Database Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!