i have multiple conditions in if statement that i want to execute but i m getting results for only last part of the statement
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
asad ali
am 25 Jun. 2019
Bearbeitet: KALYAN ACHARJYA
am 25 Jun. 2019
Error=[];
Temp=[];
Time=[];
j=1;
for i=1:1000
if ((( Digital_i < 40 ) || ( Digital_i > 52 ))&& (( THERMAL_i < 5 ) || ( THERMAL_i > 13 )) && ((Digital_i < 53) || (Digital_i > 1000)) && ((THERMAL_i < 14) || (THERMAL_i > 100)) && ((Digital < 1000) || (Digital > 2000)) && ((THERMAL_i < 101) || (THERMAL_i > 113)))
Error[j]=[str2double(Digital{i})]
j=j+1;
end
end
0 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 25 Jun. 2019
Bearbeitet: KALYAN ACHARJYA
am 25 Jun. 2019
Use II or &&
and
Error([j])
%......^^
it may be
Error[j]
3 Kommentare
KALYAN ACHARJYA
am 25 Jun. 2019
Bearbeitet: KALYAN ACHARJYA
am 25 Jun. 2019
define
cond1=(Digital_i < 40 ) || ( Digital_i > 52 );
cond2=(THERMAL_i < 5 ) || ( THERMAL_i > 13 )
......... so on
final_cond=cond1 && cond2 &&......... so on
Then
if final_cond
Error[j]=[str2double(Digital{i})]
...
end
KALYAN ACHARJYA
am 25 Jun. 2019
Bearbeitet: KALYAN ACHARJYA
am 25 Jun. 2019
Hope you get the answer.
Regards
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!