How can I change timetable to timeseries?

25 ビュー (過去 30 日間)
may95
may95 2025 年 5 月 1 日
コメント済み: Star Strider 2025 年 5 月 9 日
Hello everyone,
I am trying to convert a timetable (DD:MM:YYYY HH::MM:SS) into a time series so that I can run it in Simulink but have trouble doing so. Is anyone able to help me out?

採用された回答

Star Strider
Star Strider 2025 年 5 月 1 日
According to the timeseries documentation, it wants the data values as the first argument, and the time values as the second argument.
From the documentation:
ts = timeseries(datavals,timevals) specifies the sample times for the series. The resulting object sorts the data by time.
.
  4 件のコメント
may95
may95 2025 年 5 月 9 日
ts = timeseries(TT.Tamb, seconds(TT.Time-TT.Time(1)))
This worked! Thank you so much I could hug you through my screen.
Star Strider
Star Strider 2025 年 5 月 9 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2025 年 5 月 1 日
timeseries() does not accept duration or datetime times.
"Sample times, specified as a numeric scalar or vector, or a cell array of date character vectors. Valid date character vectors can have the following forms:"
You can use
ts = timeseries(Tsec{:,:}, datestr(Tsec.Properties.RowTimes));
  3 件のコメント
may95
may95 2025 年 5 月 9 日
Thank you for sending me this information, I didn't know this existed before. Unfortunately this caused the computer to shut down so it didn't work. Also tried Java Heap Cleaner and didn't help. Another user has answered my question. Thank you for your help! :)

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

カテゴリ

Help Center および File ExchangeTime Series Events についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by