Time intervals in a array
Show older comments
Hi everybody. I have a N x 2 cell Matrix. The First column is the time stamp and the Second column is the price at that time.
Below is a sample of the first 5 entries of the Matrix. I need to compare this data to other data and hence I would need the time intervals to be constant. As you can see the price sometimes changes more than once WITHIN A SECOND.
Hence I need a program which would create the price for every second. NOTE:: 1) IF THERE ARE MORE THAN 1 PRICE CHANGE IN ONE SECOND THE PRICE IS THE LAST ON FOR THAT SECOND.
2)PRICE WOULD STAY THE SAME UNTIL IT CHANGES
Sample of Data
'''27/01/2012 16:30:32''' 58.8500000000000
'''27/01/2012 16:30:32''' 58.8800000000000
'''27/01/2012 16:30:32''' 58.8800000000000
'''27/01/2012 16:30:44''' 58.9400000000000
'''27/01/2012 17:07:06''' 59.0854000000000
'''27/01/2012 17:12:08''' 58.9575000000000
'''27/01/2012 17:17:12''' 58.9800000000000
OUTPUT REQUIRED
16:30:32 58.88
16:30:33 58.88
16:30:34 58.88
................
16:30:44 58.94
16:30:45 58.94
ETC.......
Accepted Answer
More Answers (0)
Categories
Find more on Language Fundamentals 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!