How can I replace non positive elements of matrix with a certain number
3 ビュー (過去 30 日間)
古いコメントを表示
For example A=[7 4 2 1 -0.2 -3]
I want to get [7 4 2 0 0 ]
0 件のコメント
採用された回答
Walter Roberson
2015 年 5 月 16 日
max(A,0)
if the replacement is to be 0 for all values less than 0.
Otherwise,
B = A;
B(A<0) = new number
for any other replacement number
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!