Does in-equality operators work in comparison of two time format?

1 Ansicht (letzte 30 Tage)
Hi all, I am wondering does in-equality operators such as <= >= works if I want to compare two time format? if not is there any solution for that?
my problem is that I have time threshold , say upp_lim= 21:43:12 and low_lim=21:44:12 and I have a sample_time time_e_rad(j,:)= 21:45:53 , which I want to check if it is in the range of Upp_lim and low_lim
here is my code:
if((datenum(time_e_rad(j,:)<datenum(upp_lim))) && (datenum(time_e_rad(j,:)>=datenum(low_lim))))
but it gives me error.
any idea is appreciated .

Akzeptierte Antwort

Iain
Iain am 25 Jun. 2013
You have your brackets in the wrong places.
(datenum(time_e_rad(j,:))< datenum(upp_lim)) && (datenum(time_e_rad(j,:)) >= datenum(upp_lim))

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB 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!

Translated by