delete null in matrix

26 vues (au cours des 30 derniers jours)
Tomas
Tomas le 14 Déc 2013
Commenté : Tomas le 14 Déc 2013
I have matrix M=[ 0 0 0 7.9286 10.1000 14.3714]
I want to delete null in matrix.
I want matrix M=[7.9286 10.1000 14.3714]
Thanks

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 14 Déc 2013
Modifié(e) : Azzi Abdelmalek le 14 Déc 2013
M=[ 0 0 0 ; 7.9286 10.1000 14.3714]
M=M(all(M,2),:)
  3 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 14 Déc 2013
Still works
M=M(all(M,2),:)
Tomas
Tomas le 14 Déc 2013
Ok, Thanks

Connectez-vous pour commenter.

Plus de réponses (1)

sixwwwwww
sixwwwwww le 14 Déc 2013
do it like this:
M=[ 0 0 0 7.9286 10.1000 14.3714];
M = M(M ~= 0)
  5 commentaires
sixwwwwww
sixwwwwww le 14 Déc 2013
do you want to convert them to a column vector of non-zero values?
Tomas
Tomas le 14 Déc 2013
yes

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by