convert nans to 0
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi I have a large matrix and want to convert all nans to zeros. Any help?
0 commentaires
Réponse acceptée
Oleg Komarov
le 28 Mai 2012
% Sample input with some NaNs
A = rand(10);
A(randi([1 100],[20,1])) = NaN;
% Detect and replace NaNs
idx = isnan(A);
A(idx) = 0;
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!