Datenum error..how to fix

2 views (last 30 days)
Yasaman Best
Yasaman Best on 11 Jul 2017
Commented: Robert U on 18 Jul 2017
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 Comment
Robert U
Robert U on 18 Jul 2017
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

Sign in to comment.

Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!