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 CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by