Datenum error..how to fix
2 views (last 30 days)
Show older comments
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
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
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!