How to delete, in a logical values matrix, rows that contain two or more false values (zero)?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Giorgio Morello
el 8 de En. de 2022
Comentada: Giorgio Morello
el 8 de En. de 2022
Hello everyone! I explain my problem, trying to be as clear as possible.
I have a matrix, called "faces_logical", whose each row contains a triplet of logical values. For example:
faces_logical = [0 0 0; 0 0 0; 0 0 1; 0 0 0; 1 0 1; 1 1 1; 1 1 1; 1 1 0; 0 0 1; 0 0 1; 0 0 0];
Does exist a function in MATLAB, which allows me to obtain a vector of logical values that returns:
- "0" for every row containing or [0 0 0] or two zeros (i.e. [0 0 1], [0 1 0], [1 0 0])
- "1" for every row containing or [1 1 1] or one zero (i.e. [0 1 1], [1 0 1], [1 1 0])?
So, for the written above "faces_logical", the vector shoulds return:
[0 0 0 0 1 1 1 1 0 0 0].
Thank you in advance.
0 comentarios
Respuesta aceptada
Cris LaPierre
el 8 de En. de 2022
A single function, no, but you can obtain your desired output easily enough.
faces_logical = [0 0 0; 0 0 0; 0 0 1; 0 0 0; 1 0 1; 1 1 1; 1 1 1; 1 1 0; 0 0 1; 0 0 1; 0 0 0];
out = sum(faces_logical,2)>1
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!