Effacer les filtres
Effacer les filtres

I want to remove zeroes from an array. The array more zero per row. For example: a = [200.03 303.56 0 0 0; 155.23 0 0] Should be turned into a = [200.03 303.56; 155.23]

1 vue (au cours des 30 derniers jours)
I want to remove zeroes from an array. The array has exactly mote zero per row. For example:
a = [1 4 3 0 0 0; 1 5 0 0 0; 1 8 1 0 0; 5 4 4 0 0;1 5 2 0 0]
Should be turned into
a = [1 4 3; 1 5 5; 1 8 1; 5 4 4; 1
  1 commentaire
KSSV
KSSV le 14 Mar 2018
a = [1 4 3 0 0 0; 1 5 0 0 0; 1 8 1 0 0; 5 4 4 0 0;1 5 2 0 0]
This is not correct......please correct your question properly.

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 14 Mar 2018
a = [1 4 3 0 0 0 1 5 0 0 0 1 8 1 0 0 5 4 4 0 0 1 5 2 0 0]
% b = [1 4 3 1 5 5 1 8 1 5 4 4 1 ] ;
b = a ;
b(a==0) = [] % remove zeros
b = a ;
b(b~=0) % pick non zeroes

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by