Extracting data from a matrix

5 visualizaciones (últimos 30 días)
ieva ashmore
ieva ashmore el 29 de Abr. de 2017
Comentada: ieva ashmore el 30 de Abr. de 2017
I have a 50x3 matrix with numerical values. I want to take all the rows that have 2 zeros or more out For example
0 25 15;
0 0 25;
16 13 12
I only want to get out the first and the third row. And I do not wish to do that manually with 50 rows.

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 30 de Abr. de 2017
a = [0 25 15;
0 0 25;
16 13 12];
out = a(sum(a == 0,2) < 2,:)
  1 comentario
ieva ashmore
ieva ashmore el 30 de Abr. de 2017
Thank you. That we nice, clean and easy one line solution.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices 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