convert nans to 0
7 ビュー (過去 30 日間)
古いコメントを表示
Hi I have a large matrix and want to convert all nans to zeros. Any help?
0 件のコメント
採用された回答
Oleg Komarov
2012 年 5 月 28 日
% 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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!