picking rows which has negative element.
6 ビュー (過去 30 日間)
古いコメントを表示
hi, i have a matrix which can have negative elements. is ther eq quick and efficient way to pick the rows if any element in the row has negative values.
Thanks
0 件のコメント
採用された回答
Iman Ansari
2013 年 4 月 17 日
Hi
a=randn([5 5])+1
Nrows=sum(a<0,2);
a(Nrows>0,:)
2 件のコメント
Iman Ansari
2013 年 4 月 17 日
sum(a<0,2) is number of negative elements in each row. a<0 is one for negative values and 0 for others.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!