If else condition to set values greater or equal to one
3 ビュー (過去 30 日間)
古いコメントを表示
Turbulence Analysis
2023 年 11 月 2 日
コメント済み: Turbulence Analysis
2023 年 11 月 2 日
Hi,
I am multiplying values in the one column with other one, lets say B = A(:,1).* A(:,2)
Here before performing the multiplication, if the values in the both the columns falls bettwen -0.02 to 0.02 this needs to be set to 1. I tried with if else, but not getting the desired results.
0 件のコメント
採用された回答
Dyuman Joshi
2023 年 11 月 2 日
編集済み: Dyuman Joshi
2023 年 11 月 2 日
%Comparison of rows to find which rows have both values
%in the range [-0.02, 0.02]
idx = all(abs(A(:,1:2)) <= 0.02, 2)
%Replace the values
A(idx, 1:2) = 1
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!