omit zeros from matrix and have the shape of matrix
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
NA
el 14 de Abr. de 2019
Respondida: Kevin Rawson
el 14 de Abr. de 2019
A=[0,0;0,0;0,0;1,2;2,5;5,7;7,8];
I want to omit zero from this matrix. result should be
New_A=[1,2;2,5;5,7;7,8];
I use this code
A(A==0) = [];
But giving me array.
0 comentarios
Respuesta aceptada
Kevin Rawson
el 14 de Abr. de 2019
If you are trying to get rid of rows with zeros:
A(all(A == 0, 2), :) = [];
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!