Logical lookup between two dates
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Richard Turner
am 24 Mai 2018
Kommentiert: Richard Turner
am 25 Mai 2018
I am trying to create a logical lookup between 3 date vectors. Vector a is the lookup value (a date), Vector b is a start date, c is an end date. a is a larger size than b and c, which are both the same size.
I want to return a logical response (1) when a is b<=>c.
The vector size seems to be the main problem when trying to write this. I know there is a simple way to do it, but cant find the answer.
3 Kommentare
Jan
am 24 Mai 2018
What does "b<=>c" mean? What exactly is a "date vector"? Please provide some input data.
Akzeptierte Antwort
Guillaume
am 24 Mai 2018
Assuming R2016b or later:
sum(a >= b' & a <= c')
In earlier versions
sum(bsxfun(@ge, a, b') & bsxfun(@le, a, c'))
a, b, c must be date numbers
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Calendar 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!