Effacer les filtres
Effacer les filtres

removing zeros from a matrix

3 vues (au cours des 30 derniers jours)
vedesh Mohit
vedesh Mohit le 3 Avr 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?

Réponse acceptée

David Fletcher
David Fletcher le 3 Avr 2018
  2 commentaires
vedesh Mohit
vedesh Mohit le 3 Avr 2018
does this also look at the zeros in values like 10 or 100 or just the value zero alone?
David Fletcher
David Fletcher le 3 Avr 2018
Modifié(e) : David Fletcher le 3 Avr 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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by