Reshape dataset with time intervals?
Show older comments
I have a dataset with time(in seconds) in the first column and price for each time stamp in the second column. The increments in seconds are random, so i want to create 10 second time intervals in my data.
I then want to select the price from the data that lies the closest to the upper-limit of the time-interval, as the price value for that given interval. I have tried setting up a loop but i dont know how to tell matlab to choose the first value within each interval, as the position of this first value varies form interval to interval.
i.e.
time, price
4711, 192.30
4713, 192.32
4714, 192.31
4717, 192.34
4718, 192.30
Turned into:
time, price
4711-4715, 192.30
4716-4720, 192.34
Accepted Answer
More Answers (0)
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!