Azzera filtri
Azzera filtri

Delete of a partially zero row

1 visualizzazione (ultimi 30 giorni)
giuseppe
giuseppe il 12 Nov 2014
Commentato: dpb il 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 Commento
dpb
dpb il 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by