Info
この質問は閉じられています。 編集または回答するには再度開いてください。
replace some elements to zero if they are not NaN
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix
A=[2 3 NaN NaN 3 NaN NaN 9 9 9;
3 4 NaN NaN 3 NaN NaN 9 5 8;
1 2 NaN NaN 4 NaN NaN 8 7 9]
I want to replace 30% of non zero elements in each row to 0.. for example, 30% of non-zero elements is 2.I want to replace each row with 2 zeros
A=[0 3 NaN NaN 3 NaN NaN 9 0 9;
3 4 NaN NaN 0 NaN NaN 9 0 8;
1 0 NaN NaN 4 NaN NaN 8 0 9]
how can I do this? I have done some but for that case no Nan is available in matrix but in this case I want that Nan remains and rest is replaced. Please guide.
2 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!