Error when using readtable!

조회 수: 10 (최근 30일)
Debbie Oomen
Debbie Oomen 2018년 5월 2일
댓글: Matthew Esch 2018년 5월 4일
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개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by