I would like to remove zeros from my matrix
Mostrar comentarios más antiguos
a=[0 0 0; 0 0 0; 1 2 3; 4 5 6]
3 comentarios
Rik
el 26 de Oct. de 2021
What have you tried so far?
a=[0 0 0; 0 0 0; 1 2 3; 4 5 6]
a(a>0) % the results would be a column vector
% Or try to remove the row or the columns with zeros
a(1:2,:) = []
a
Rik
el 27 de Oct. de 2021
@Aladdin, this is an answer to what might be a homework question. Please consider either moving your comment to the answer section (by deleting this and reposting it) or deleting your comment.
Respuestas (1)
a = [0 0 0; 0 0 0; 1 2 3; 4 5 6]
b = rmmissing(standardizeMissing(a, 0))
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!