Statements on time table

1 回表示 (過去 30 日間)
Adnan Jayyousi
Adnan Jayyousi 2022 年 6 月 21 日
回答済み: Nitanshu 2022 年 6 月 28 日
Hello everyone,
I have imported a time table including 8760 hours (one year hours),
I want to make some logic and,
How can I make a statement that returns '1' or '0' if a day is inbetween days ?
or if a month is in between months range ?
for example :
If "feb" is between "jan" and "march" --> return '1'
if "thursday" is between "sunday" & "wedendsday" --> return '0'
thanks
  1 件のコメント
dpb
dpb 2022 年 6 月 21 日
See withinrange and/or timerange and friends...

サインインしてコメントする。

採用された回答

Nitanshu
Nitanshu 2022 年 6 月 28 日
Hi Adnan,
Probably you could take help from the below code where i did it for checking if a particular date lies between two dates or not. Also for more information you could take the help of this article.
t1 = datetime(2022, 3, 2); % t1 denotes 2 march 2022
t2 = datetime(2022, 10, 4); % t2 denotes 4 october 2022
t3 = datetime(2022, 11, 5); % t3 denotes 5 november 2022
range = timetable(t1, t2)
is_t3_in_range = withinrange(range, t3)
Hope it helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by