Filter löschen
Filter löschen

Delete of a partially zero row

1 Ansicht (letzte 30 Tage)
giuseppe
giuseppe am 12 Nov. 2014
Kommentiert: dpb am 12 Nov. 2014
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 Kommentar
dpb
dpb am 12 Nov. 2014
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by