配列からゼロを取り除くにはどうしたらよいですか?
Afficher commentaires plus anciens
配列からゼロを取り除きたいと考えています。この配列には各行にちょうど1つのゼロが含まれています。例えば、以下の配列があります。
a = [1 4 0 3; 0 1 5 5; 1 0 8 1; 5 4 4 0; 0 1 5 2]
この配列を次のようにしたいです。
a = [1 4 3; 1 5 5; 1 8 1; 5 4 4; 1 5 2]
a(a==0) = []; というコマンドを試しましたが、2000x50の配列が1x98000の配列になってしまい、2000x49の配列にはなりません。何か良い方法はありますか?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur 数値型 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!