How can I replace integer values in a array?
1 回表示 (過去 30 日間)
古いコメントを表示
I Have some values in a array like this.
A = -4
-4
-4
4
4
4
I want to convert all negative values to 0 and all positive values to 1.
How can I do that.??
Outcome should be :
B = 0
0
0
1
1
1
0 件のコメント
回答 (2 件)
Image Analyst
2021 年 1 月 3 日
We already answered this in your other question:
B = double(A > 0)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!