convert nans to 0
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have a large matrix and want to convert all nans to zeros. Any help?
0 Kommentare
Akzeptierte Antwort
Oleg Komarov
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!