removing zeros from a matrix
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    vedesh Mohit
 el 3 de Abr. de 2018
  
    
    
    
    
    Editada: David Fletcher
      
 el 3 de Abr. de 2018
            Hey I have a matrix x=[1;2;0;0;0;3;4;5;0;6;0;4;0;6;3;2;1;1;0]; how do I remove the zeros from this matrix?
0 comentarios
Respuesta aceptada
  David Fletcher
      
 el 3 de Abr. de 2018
        x(x==0)=[]
2 comentarios
  David Fletcher
      
 el 3 de Abr. de 2018
				
      Editada: David Fletcher
      
 el 3 de Abr. de 2018
  
			No, just the value of 0. If you need to remove the zeros in everything, it might be easier to convert it to a string, remove the zero characters, and then convert it back to numbers
Más respuestas (0)
Ver también
Categorías
				Más información sobre Resizing and Reshaping 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!