MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Compare a duration array to a numeric array. Elements in the numeric array are treated
as a number of fixed-length (24-hour) days.


A < [1; 1/24]


ans = 2x1 logical array


1
0


Determine if Dates and Time Are Contained Within an Interval


Use the isbetween function to determine whether values in a datetime array lie within
a closed interval.


Define endpoints of an interval.


tlower = datetime(2014,08,01)


tlower = datetime
01-Aug-2014


tupper = datetime(2014,09,01)


tupper = datetime
01-Sep-2014


Create a datetime array and determine whether the values lie within the interval
bounded by t1 and t2.


A = datetime(2014,08,21) + calweeks(0:2)


A = 1x3 datetime array
21-Aug-2014 28-Aug-2014 04-Sep-2014


tf = isbetween(A,tlower,tupper)


tf = 1x3 logical array


Compare Dates and Time
Free download pdf