how do i count NaNs in a vectors or array??
Afficher commentaires plus anciens
Sir I have a vector say
A=[5,5,6,NaN,NaN,8,10,5,7,3,NaN,11,5,3,8,9,7,NaN,NaN,NaN,NaN,NaN]
and i want to count the number of NaNs in between the numbers. The result should be[2,1,5]. how can I do it sir? please help
Réponse acceptée
Plus de réponses (1)
Matt J
le 1 Fév 2015
C=SplitVec(isnan(A),'equal',@sum);
result=nonzeros([C{:}]).';
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!