How to convert time into matlab system?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
angelavtc
il 23 Apr 2016
Modificato: Azzi Abdelmalek
il 23 Apr 2016
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!
0 Commenti
Risposta accettata
Azzi Abdelmalek
il 23 Apr 2016
A={'2000/02/15' '12:30';'2015/03/16' '18:55'}
b=arrayfun(@(x) strjoin(A(x,:)),(1:size(A,1))','un',0)
out=[A b]
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Dates and Time in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!