Why do I have an error saying "Invalid file identifier"?

17 visualizaciones (últimos 30 días)
Hannah
Hannah el 18 de Ag. de 2021
Respondida: the cyclist el 18 de Ag. de 2021
Hello, I have an error saying:
Error using fprintf
Invalid file identifier. Use fopen to generate
a valid file identifier.
Error in EXP1_Generate_batch_ver1 (line 106)
fprintf(fileID,'Formattyp = 1\n');
this is my code:
myBatchName = '\\\\data-be\\data-ti-2019\\eit\\50_Labore\\T016-Photovoltaik_1\\06_Projekte\\02_Aktiv\\2019_Schenker_Storen\\DOCS_Hannah\\Experiment1\\02_Generate_Batch_File\\Batch.csv';
fileID = fopen(myBatchName,'w');
fprintf(fileID,'Formattyp = 1\n');
fprintf(fileID,'Save = month\n');
fprintf(fileID,'name ; longitude ; latitude ; altitude ; hor ; azimuth ; inclination \n'); %column titles
path='\\\\data-be\\data-ti-2019\\eit\\50_Labore\\T016-Photovoltaik_1\\06_Projekte\\02_Aktiv\\2019_Schenker_Storen\\DOCS_Hannah\\Experiment1\\02_Generate_Batch_File\\';
what am I doing wrong? Thanks :)

Respuestas (1)

the cyclist
the cyclist el 18 de Ag. de 2021
I would guess that the value of fileID that is generated is -1, meaning that there was a problem with the fopen function. A likely culprit is that you do not have write permissions.
Take a look at this question/answer for some ideas on how to resolve it.

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by