Date Conversion Not Working Again
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I'm sorry for posting a similar problem again - I keep encountering it and I'm not sure what i'm doing wrong. I simply want to upload a series of dates into MatLab but every time it goes through datnum to datestr the dates that come out are completely different to those I put in. I thought the problem last time might have been using excel to upload the data so now I'm only using text files. I have attached the bit of code and my input file - the first three dates I get back in the date string are - 04-Apr-2017, 06-Jul-2018, 06-Oct-2018. Any help or advice would be very much appreciated.
% Load OB Data
OB20172 = readtable('OB20176.txt');
% Create GS Time
datetime.setDefaultFormats('default','dd-MM-yyyy');
t1 = datetime(2017,04,1,0,0,0);
t2 = datetime(2017,10,31,8,0,0);
GS2017 = t1:t2;
%Convert OB Date
OBDates = OB20172;
OB2017 = table2array(OBDates);
OBDateNumbers = datenum(OB2017);
DateString = datestr(OBDateNumbers);
Réponses (0)
Voir également
Catégories
En savoir plus sur Dates and Time dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!