read date in NCD file

7 ビュー (過去 30 日間)
sherien al-azerji
sherien al-azerji 2015 年 10 月 19 日
コメント済み: Walter Roberson 2015 年 10 月 19 日
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

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 19 日
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 件のコメント
sherien al-azerji
sherien al-azerji 2015 年 10 月 19 日
Thank you so much, it work well now. can ask one more question please.
now I get the dates in (str) how can convert the str to be matrix so the fisrt column is the year, the second column is month and the third colum be the days
Many Thanks
Walter Roberson
Walter Roberson 2015 年 10 月 19 日
Instead of converting them to strings, use datevec() and extract the first three columns.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by