Datenum error..how to fix

2 ビュー (過去 30 日間)
Yasaman Best
Yasaman Best 2017 年 7 月 11 日
コメント済み: Robert U 2017 年 7 月 18 日
bouts_data = [datenum(raw_bouts_data(2:end,5), 'dd/mm/yyyy HH:MM:SS PM'), ...
datenum(raw_bouts_data(2:end,6), 'dd/mm/yyyy HH:MM:SS PM'), ...
cell2mat(raw_bouts_data(2:end,7:end))];
  • Error in DataLogger_DailyBouts (line 36) bouts_data = [datenum(raw_bouts_data(2:end,5), 'dd/mm/yyyy HH:MM:SS PM'), ...
Caused by: Error using datenum (line 107) The input to DATENUM was not an array of strings.*
I'm trying to read an excel file and I get this error why? How to fix it?
  1 件のコメント
Robert U
Robert U 2017 年 7 月 18 日
Hi, my first guess would be that you read your Excel sheet by utilizing
[num,txt,raw] = xlsread(___)
where your output raw_bouts_data is representing the "raw"-output from xlsread().
Writing now raw_bouts_data(2:end,5) gives you a cell whereas you need a string:
[datenum(raw_bouts_data{2:end,5}, 'dd/mm/yyyy HH:MM:SS PM'), ...
datenum(raw_bouts_data{2:end,6}, 'dd/mm/yyyy HH:MM:SS PM'), ...
cell2mat(raw_bouts_data(2:end,7:end))];
Kind regards,
Robert Uhlig

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

回答 (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