フィルターのクリア

Delete of a partially zero row

1 回表示 (過去 30 日間)
giuseppe
giuseppe 2014 年 11 月 12 日
コメント済み: dpb 2014 年 11 月 12 日
Hi,
I need to delete rows in a matrix where the most elements in these rows are zero but one element is not zero. I need to use a for cicle or there is a set of instructions to make this task? I tried:
mini( ~any(mini,2), : ) = []
where mini is a matrix of 100 rows and 7 columns. But this instruction not resolve my problem because one row is
0,0,0,0,0,6.7710
The same is with
mini( ~any(mini,2), 1:6 ) = []
in the 7's column there is the no-zero element. Can someone help me? Thank. Giuseppe
  1 件のコメント
dpb
dpb 2014 年 11 月 12 日
It's ambiguous what your decision criterion is to delete the row -- is it any row which has none or only one non-zero element or some other reason for that row to be deleted?
You can code for any condition you can write a rule for but have to have the rule to follow first.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by