フィルターのクリア

what is my problem in using datevec?

2 ビュー (過去 30 日間)
Ryoung seob Kwon
Ryoung seob Kwon 2016 年 9 月 18 日
編集済み: Stephen23 2016 年 9 月 21 日
cd('C:\Users\Kwom\Desktop');
% I loaded my folder
file=xlsread('Week02_climate_data_analysis.xls');
% I loaded my Excel file in my folder. - 14244x5 double
% in the excel file, the column is date (ex. 19730101) the row is temperature, humidity...etc.
% my purpose is to separate the spring(March~May), summer(June~August), fall(September~November), winter(December~February) by using 'datevec' in Excel's column.
% So, I made these ones...
date=num2str(file(:,1));
dateformat='yyyy,mm,dd';
datevec(date,dateformat)
However, it has a error... I don't know what is a problem...
What should I do...?
  1 件のコメント
Stephen23
Stephen23 2016 年 9 月 21 日
編集済み: Stephen23 2016 年 9 月 21 日
"What should I do...?"
Use the correct date format string:
>> datevec('19730101','yyyymmdd')
ans =
1973 1 1 0 0 0

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

回答 (1 件)

Saurabh Gupta
Saurabh Gupta 2016 年 9 月 21 日
Hello Ryoung,
Based on your description, it seems that your date values are in the format 'yyyymmdd' (ex. 19730101), but you are using the date format as ‘yyyy,mm,dd’ for the datevec function. Your ‘dateformat’ string should match the date format in your ‘date’ string (i.e. the format of the date values in your source file).

カテゴリ

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