filter a timetable by day

2 ビュー (過去 30 日間)
Angelavtc
Angelavtc 2020 年 3 月 31 日
コメント済み: Star Strider 2020 年 3 月 31 日
Hi!
How can I create timetable that only groups the information from the following timetable by day?
timeStamps = datetime([2017 3 4; 2017 3 5; 2017 3 4; 2017 3 5; 2017 3 4; 2017 3 5; 2017 3 4; 2017 3 5]);
hour = [8 8 8 8 9 9 9 9]';
Volume = [5 10 15 20 25 30 35 40]';
Price= [40 35 30 25 20 15 10 5]';
T= table(timeStamps, hour, Volume, Price)
TT= table2timetable(T)
This is just an example, my real timetable is composed of several days, perhaps with a for loop?

採用された回答

Star Strider
Star Strider 2020 年 3 月 31 日
I am not certain what you intend by ‘groups’.
One option is to use the retime function:
TTRT = retime(TT, 'daily','mean')
producing:
TTRT =
2×3 timetable
timeStamps hour Volume Price
___________ ____ ______ _____
04-Mar-2017 8.5 20 25
05-Mar-2017 8.5 25 20
  6 件のコメント
Angelavtc
Angelavtc 2020 年 3 月 31 日
@Star Strider but how can I do a loop so it creates the daily subtimetables from one command. For example here, something like:
for i=1:length(TTS);
TTS_i=TTS{i};
end
Star Strider
Star Strider 2020 年 3 月 31 日
As always, my pleasure!
My code creates them automatically. Use the addressing I used to see and use each one.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePulse and Transition Metrics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by