If else condition to set values greater or equal to one
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Turbulence Analysis
am 2 Nov. 2023
Kommentiert: Turbulence Analysis
am 2 Nov. 2023
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 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 2 Nov. 2023
Bearbeitet: Dyuman Joshi
am 2 Nov. 2023
%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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!