how to check the value is above or below certain number in the set of columns
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Turbulence Analysis
am 10 Okt. 2023
Beantwortet: Sulaymon Eshkabilov
am 10 Okt. 2023
Hi,
In the attached data, from the columns 225 to 247, I need to check does any values in the row 1 exceeds 600. If exceeds, it should store value 1, otherwise 0 in the another array named say X.
Could someone help me with this?
1 Kommentar
Akzeptierte Antwort
Sulaymon Eshkabilov
am 10 Okt. 2023
If undestood correctly your question, logical indexing would be one of the easy solutions:
X2 = load('matlab.mat').x2;
Y = X2;
D = X2(1, 225:247);
%% Condition 1
D(D>600)=1;
X2(1, 225:247)=D; % Original X2 values are changed
X_X2 = X2(1, 225:247) %# Check the substituted values
%% Condition 2
D = Y(1, 225:247);
D((D<600)) = 0;
D((D>600)) = 1;
X = Y;
X(1, 225:247)=D;
X_X = X(1, 225:247) %# Check the substituted values
%% Put both condition findings into X2 imported original data
X2(1, 225:247)=X_X;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!