how can ı solve this error ? Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Burak Kurt
le 31 Mai 2015
Réponse apportée : Aparna Komarla
le 2 Oct 2018
clear all;clc;
y=[2 3 4 5;5 6 7 8]
fid=fopen('myfile.txt','wt');
fprintf(fid,'%d,%d\n',y);
fclose(fid);
0 commentaires
Réponse acceptée
Jan
le 31 Mai 2015
Check the success of fopen in every case, under all circumstances, ever, nerver omit this test:
filename = 'myfile.txt';
filepath = cd;
file = fullfile(filepath, filename);
fid = fopen(file, 'wt');
if fid==-1
error('Cannot open file for writing: %s', file);
end
I guess you do not have privileges to write to the current folder.
Plus de réponses (2)
Caio Vaz Rimoli
le 4 Sep 2018
Just brief comment: I also got this error because I ran out HD memory.
0 commentaires
Aparna Komarla
le 2 Oct 2018
Creating the directory you are storing the files/data in first might help!
0 commentaires
Voir également
Catégories
En savoir plus sur Troubleshooting in MATLAB Compiler SDK 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!