Error when using readtable!

8 次查看(过去 30 天)
Debbie Oomen
Debbie Oomen 2018-5-2
Error using readtable (line 197)
Unable to open file '/Users/debbieoomen/Desktop/Data Files/ActiGraphTemplateDiary.xlsx' as a workbook. Check that
the file exists, read access is available, and the file is a valid spreadsheet file.
Error in ReadDiary (line 8)
diaryfile = readtable(DiaryFile)
This code worked yesterday. However, I have changed one or two things in the sheet on my MacBook (which shouldn't be an issue). Now I keep on getting this error.
[DiaryFile,DiaryFolder] = uigetfile({'*.xls;*.csv;*.txt;*.xlsx'});
if isequal(DiaryFile,0);
ErrorDiaryfile = msgbox('No diary file selected', 'Error','error');
return
else
addpath(DiaryFolder)
diaryfile = readtable(DiaryFile)
end
I have tried turning off my mac, restarting matlab and closing excel but nothing works. Not all excel files get this error but I have attached the one that does.
  1 个评论
Matthew Esch
Matthew Esch 2018-5-4
When I went to open the "ActiGraphTemplateDiary.xls" file you included, I got a warning that the file extension did not match the file format (On Windows). I re-saved the file as "ActiGraphTemplateDiary.xlsx".
On MAC, I ran into the same error you did executing the provided code the ".xls" file, but it worked on the ".xlsx" file without issue. Try resaving the file to the more modern ".xlsx" extension and see if it resolves the issue.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by