create 5 minute bar intervals of time data

4 ビュー (過去 30 日間)
Akram Hussein
Akram Hussein 2020 年 7 月 3 日
回答済み: Akram Hussein 2020 年 7 月 4 日
I have a csv file with price data and it is organized in date in MM/dd/yyyy and time in HH:mm:ss. The data is in 1 second intervals. I am trying to create specific intervals of that data let's say 5 minute intervals and read the prices at that time and plot a bar chart.
However, in trying to do so I found the data maybe missing few seconds here and there. So what is the best way to get something like
date Time Price
7/3/2020 17:00:00 452
7/3/2020 17:05:00 430
7/3/2020 17:10:00 444

回答 (1 件)

Akram Hussein
Akram Hussein 2020 年 7 月 4 日
For some reason someone posted an answer but then it got deleted. Anyway posting it again for others
t = readtimetable(filename);
dt = minutes(5);
tt5min = retime(tt,'regular','linear','TimeStep',dt);

カテゴリ

Help Center および File ExchangeFinancial Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by