How to make a NaN vector if there is a single NaN in a column?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Say you have a vector
A= [ 2 4 6 8 NaN 10 12 14]
How do you make a NaN vector if and only if there is a NaN in one of the columnns:
A = [NaN NaN NaN NaN NaN... ]
0 commentaires
Réponse acceptée
madhan ravi
le 28 Juil 2020
[m, n] = size(A);
A = nan(m, any(isnan(A(:))) * n)
8 commentaires
madhan ravi
le 28 Juil 2020
Sorry I’m not a mind reader:(
ix = nan(m, any(isnan(A(:)))* n);
if isempty(ix)
A = A
else
A = ix
end
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!