Borrar filtros
Borrar filtros

Delete of a partially zero row

1 visualización (últimos 30 días)
giuseppe
giuseppe el 12 de Nov. de 2014
Comentada: dpb el 12 de Nov. de 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 comentario
dpb
dpb el 12 de Nov. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by