How to exchange all values of a row to zero, if this row contains one or more NaNs?

3 ビュー (過去 30 日間)
Valentin
Valentin 2017 年 3 月 16 日
コメント済み: Valentin 2017 年 3 月 16 日
Hey guys,
I have a matrix like that:
2945 545 2 2 2,82; 2394 345 NaN 3 4,89; 3453 123 23 4 NaN; 4564 435 53 2 2,98
How can I change all numbers of a row which contains one or more NaNs to zero? The desired output would be:
2945 545 2 2 2,82; 0 0 0 0 0; 0 0 0 0 0; 4564 435 53 2 2,98
Thanks a lot for your help! Valle

採用された回答

Guillaume
Guillaume 2017 年 3 月 16 日
yourmatrix(any(isnan(yourmatrix), 2), :) = 0

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by