Why do I get the error 'Ensure the file is a valid spreadsheet file and is not password protected.'?
67 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Johannes Hougaard
le 17 Août 2021
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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Import and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!