delete rows which contain at least 1 zero

61 visualizaciones (últimos 30 días)
Mate 2u
Mate 2u el 7 de Jun. de 2012
Movida: Voss el 24 de Mzo. de 2024
Hi there I have a large matrix A. I want to delete every row which contains at least 1 zero in the row.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 7 de Jun. de 2012
out = A(all(A,2),:);
or
out=A;
out(any(A==0,2),:) = [];
  2 comentarios
Anthony Mukanya
Anthony Mukanya el 17 de Ag. de 2015
Movida: Voss el 24 de Mzo. de 2024
Thanks Andrei,
I tried what you suggested and it worked.
Now I would like to know what I should do keep the last row even if it contains a zero. The reason for this is because the entry on the nth row and jth must be zero.
Thanks
Alyaa Ghazi
Alyaa Ghazi el 24 de Mzo. de 2024
great,it's very useful

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by