Effacer les filtres
Effacer les filtres

How can i skip the zeros in a matrix?

1 vue (au cours des 30 derniers jours)
Maayan
Maayan le 11 Sep 2013
Hi, I have a matrix with columns filled with zeros and i want to copy the matrix into a new matrix but to skip the columns with the zeros. Is there any command that can help me? I tried to do it with the sparse command but i didn't really understand what happens there. It skips the zeros but when you want to know how many columns you have in the new matrix it still shows the initial size. thanks in advance!

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Sep 2013
NewMatrix = OldMatrix(any(OldMatrix,1),:);

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays 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