Big table with zero
4 ビュー (過去 30 日間)
古いコメントを表示
T = [];
p=5;
for i =5:10
p=i+1;
T = data(p,11:74)
T(:,all(ismissing(T,0)))=[]
end
I have a big table where I need to read the entries row wise and remove all the col which has zero value. I am reading all the row using a loop . Kindly let me know the best.
var1 var2 var3 var4 var5
row1 0 1 0 0 1
var1 var2 var3 var4 var5
row2 1 1 0 0 1
results should be
var1 var2 var5
row2 1 1 1
0 件のコメント
採用された回答
Kevin Phung
2019 年 3 月 14 日
for an array, say:
a =
1 0 0
1 0 1
1 1 1
0 0 1
you can just do:
any(a==0,1)
to find all columns that contain a 0.
7 件のコメント
Walter Roberson
2019 年 3 月 18 日
T{:,col}
The table indexing syntax permits a cell array of column names.
その他の回答 (2 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!