How do I create a time stamp with 5 minutes interval?

7 次查看(过去 30 天)
Hi everyone! I still trying to solve the next problem, sorry for too much asking but I really need to solve this:
I have two columns column A are dates and times and column B are prices. Column A is in Matlab format and looks like this:
[02-Jan-1990 10:09:00
02-Jan-1990 10:10:00
02-Jan-1990 10:11:00
02-Jan-1990 10:12:00 ...]
the variable description is char
And column B:
[353.400
353.2500
353.0200
352.9700
...]
the variable description is double
I need to rearrange A column so it gives me the prices in 5 minutes intervals and the corresponding price B (now I have them for every minute).
Column A goes from 1990 until 2016 so the calculation has to consider changes in days, months and years.
Thanks a lot for your help!
  2 个评论
dpb
dpb 2016-4-24
  1. Are there missing data or are all one-minute values present?
  2. What's the output--a given sample at 5-minute intervals, average, max/min, ...?
angelavtc
angelavtc 2016-4-24
Dear Isakson I dont need to calculate the average of five minutes. What I need is just to "filter" my data. I have observations for every minute and its corresponding price (in column B). But I just need the information each 5 minutes with its corresponding price.
Dear dpb 1.- I dont have missing data 2.- The output is just to have the price for every 5-minute interval. lets say that I need to create another 2 columns where the first gives just the date for every 5 minutes 9:00, 9:05, 9:10 and the second its corresponding price.
Thanks a lot for the help, I hope I could solve your doubts.

请先登录,再进行评论。

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2016-4-24
A(1:5:end)
B(1:5:end)
  5 个评论
angelavtc
angelavtc 2016-4-24
Also this moving window has to stop when the day finish. How do I include this in the function that you mentioned when un said "just use a variable in place of the first index in the indexing expression under program control"?
Thanks dbp and Azzi.
dpb
dpb 2016-4-24
Learn to use the {}Code button to format your code (or simply begin the code section w/ a new paragraph and two blanks on first line); no sense we should have to clean it up for you...
As for the follow-up
R=[0; diff(log(s))];
no loop needed.
Well, there's a new rub on the time; what do you mean by moving window stop[s] when the day finish[es]"? What happens for the next and subsequent days? You don't define the problem in its entirety at the beginning but keep adding bits 'n pieces...

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Variables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by