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

3 visualizaciones (últimos 30 días)
angelavtc
angelavtc el 24 de Abr. de 2016
Comentada: dpb el 24 de Abr. de 2016
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 comentarios
dpb
dpb el 24 de Abr. de 2016
  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 el 24 de Abr. de 2016
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.

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 24 de Abr. de 2016
A(1:5:end)
B(1:5:end)
  5 comentarios
angelavtc
angelavtc el 24 de Abr. de 2016
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 el 24 de Abr. de 2016
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...

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Just for fun en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by