How do I combine three cells to output a date time?
Show older comments
My data is a .txt file with the first three fields beining the date time in the following format:
year doy timez
2017 100 04:03:00 Z
I used
D=datevec(datenum(year,1,doy));
D=datetime(D);
to get the year, month, day and 00:00:00
but I can't seem to get the timez to parse out. timez was imported into a table as a cell whereas year and doy were imported as double.
3 Comments
Matthew Eicholtz
on 9 May 2017
Can you provide a sample text file that you are using as well as the desired output? Are you trying to print the date and time to the Command Window or store it as a variable?
Jan
on 9 May 2017
You used "D=datevec(datenum(year,1,doy))", but how did you obtain "year" and "doy"?
Matt Martin
on 9 May 2017
Accepted Answer
More Answers (0)
Categories
Find more on Web Services 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!