transforming a matrix to an array without one values???

Hi all
I have a matrix having some values equal to one. I want to transform this matrix to an array without the one values.
how can I do this? for example a=[13 1 4; 45 23 1; 1 56 78] changed to b=[13 45 23 56 4 78]
cheers,

 Réponse acceptée

a=[13 1 4; 45 23 1; 1 56 78];
indices = find(a==1);
a(indices) = [];

2 commentaires

som
som le 31 Déc 2011
thanks for your guidance.
Even quicker and cleaner:
a(a==1) = [];

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays 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!

Translated by