How to convert time into matlab system?
Afficher commentaires plus anciens
Hello everyone,
I have two columns A,B the first one ,A,contains a date (Year, Month and Day) while B contains hours and minutes. I want to create a third column C where I merge both columns. Initially, A and B were double so I used the next code to tranforme them to Matlab date system:
A = sp500_onemin(:,1)
d = datenum(num2str(A),'yyyymmdd')
date = datestr(d,20)
My first problem is when I tried to transform column B (composed by hours and minutes) and I used the nextc command, Matlab always gives me the same number in "time":
B = sp500_onemin(:,2)
t= num2str(B)
time= datenum(t,'HHMM')
Can someone please tell me where is my mistake?
After fixing this, how can I merge column A and B to have a new column compose by date and time?
Thanks a lot for your help!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Dates and Time dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!