read date in NCD file
7 views (last 30 days)
Show older comments
sherien al-azerji
on 19 Oct 2015
Commented: Walter Roberson
on 19 Oct 2015
Dear all, I'm trying to extract the dates from NCD file where the date should start from 1st_january 1962 untill 31st_December 1962. However When I extract the date from the NCD file, I get these numbers (for example the first five days) 59169 59170 59171 59172 59173 and when tried to convert these numbers to a calender date I get these dates. 0161 12 30 0161 12 31 0162 01 01 0162 01 02 0162 01 03 I also checked the NCD file using the NCD viewer and I found that the dates are from 1st_January 1962, so there is nothing wrong with the NCD file, I just need to know how to convert these numbers to the exact date. Can anyone help me to convert these numbers to calendar dates starting from 1st_january 1962 please?
Thanks in advance
0 Comments
Accepted Answer
Walter Roberson
on 19 Oct 2015
Add datenum('1800-1-1') to those 59169 59170 59171 59172 59173 to get the datenum representation in MATLAB. You can then datestr() them and so on.
2 Comments
Walter Roberson
on 19 Oct 2015
Instead of converting them to strings, use datevec() and extract the first three columns.
More Answers (0)
See Also
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!