Why do I get the error 'Ensure the file is a valid spreadsheet file and is not password protected.'?
조회 수: 26 (최근 30일)
이전 댓글 표시
I want to create an excel file called 'Results' in the same directory as my matlab file. This is the code I wrote so far:
Result_File='Results.xlsx'; %save result into this excel file
% [a loop is here to obtain 'T']
fid = fopen(Result_File,'w');
writetable(T,Result_File)
when I run it, I get the error:
Error using EXP2_Ver12_Evaluation_of_Meteonorm_simulation (line 105)
Unable to write to file
'\\data-be\data-ti-2019\eit\50_Labore\T016-Photovoltaik_1\06_Projekte\02_Aktiv\2019_Schenker_Storen\DOCS_Hannah\Experiment2\04_Evaluation_of_Meteonorm_simulation\Results.xlsx'.
Ensure the file is a valid spreadsheet file and is not password protected.
I dont understrand how it could be passwprd protected or not valid because my script creates the file that I am writing into.
댓글 수: 0
채택된 답변
Johannes Hougaard
2021년 8월 17일
Because you make and open the (empty) file with the fopen call but don't use the file identifier for the writetable (which you shouldn't do).
make sure you have all file identifiers closed (exit MATLAB or call fclose all), delete the Results.xlsx file and re-run the code without fopen
Result_File='Results.xlsx'; %save result into this excel file
% [a loop is here to obtain 'T']
writetable(T,Result_File)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!