Importing month into Matlab is not recognized
Show older comments
Goodday,
I'm trying to import a txt/CSV file into matlab by using datastore. (Also see attached txt file)
NO.,Time,ms,"V","V","Hz","Hz","A1234567890","ALP1-4","AO1234"
1,2019/10/10 11:09:15, 0,+ 1.883,+ 24.00, 78, 37,LLLLLLLLLL,LLLL,LLLL
2,2019/10/10 11:09:15,200,+ 1.886,+ 24.00, 78, 37,LLLLLLLLLL,LLLL,LLLL
So in order to import with the correct format, my script is:
dat = datastore('TEST.txt')
dat.SelectedVariableNames = dat.SelectedVariableNames([1:7]);
dat.SelectedFormats{1} = '%f';
dat.SelectedFormats{2} = '%{YYYY/MM/DD HH:mm:ss}D';
dat.SelectedFormats{3} = '%f';
dat.SelectedFormats{4} = '+%f';
dat.SelectedFormats{5} = '+%f';
dat.SelectedFormats{6} = '%f';
dat.SelectedFormats{7} = '%f';
However when i run a preview (or import) the data i get the following result:
Number Date_Time ms CH1 CH2 Pulse1 Pulse2
______ ___________________ ___ _____ ___ ______ ______
1 2019/01/10 11:09:15 0 1.883 24 78 37
2 2019/01/10 11:09:15 200 1.886 24 78 37
3 2019/01/10 11:09:15 400 1.883 24 78 36
4 2019/01/10 11:09:15 600 1.884 24 79 37
5 2019/01/10 11:09:15 800 1.886 24 78 37
6 2019/01/10 11:09:16 0 1.883 24 78 36
7 2019/01/10 11:09:16 200 1.882 24 79 37
The month has been set to januari instead of oktober and i don't understand why matlab does not reconizing the month from the original data correctly.
Any help would be much appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!