Applying within range function
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adnan Jayyousi
am 23 Jun. 2022
Beantwortet: Steven Lord
am 23 Jun. 2022
Hello everyone,
The code is :
%% Define date&time arrays :
t1 = datetime(2021,1,1,0,0,0);
t2 = datetime(2021,12,31,23,0,0);
DateNtime = (t1:hours(1):t2)'
Holidays = datetime({'2021-03-27';'2021-03-28';'2021-04-02';'2021-04-03';
'2021-04-14';'2021-04-15';'2021-5-16';'2021-05-17';'2021-09-06';'2021-09-07';'2021-09-15';'2021-09-16';'2021-09-20';'2021-09-27'});
rangeOfTimes = timerange(t1,t2);
tf = withinrange(Holidays(1,1), rangeOfTimes);
-----
In the "tf" array i am getting argument error. What causes the error ?
Thanks
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 23 Jun. 2022
The withinrange function requires its first input to be a timetable, not a datetime array. You probably want isbetween instead.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time 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!