saving data to the file
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
How to use function fprintf in Matlab2016b? Why thoe following comands are uncorrect?
fid = fopen('file.txt','a');
fprintf(fid,'%.6f %.6f %.6f\n',xw,yw,rw);
fclose(fid);
4 Commenti
KSSV
il 10 Ott 2016
fid = fopen('file.txt','a');
xw = rand(1) ;
yw = rand(1) ;
rw = rand(1) ;
fprintf(fid,'%.6f %.6f %.6f\n',xw,yw,rw);
fclose(fid);
works very fine....what error it pop's out for you?
José-Luis
il 10 Ott 2016
What's the error message you are getting?
Artur Lipnicki
il 10 Ott 2016
José-Luis
il 10 Ott 2016
What's the value of fid?
Do you have write access to the current folder?
Risposte (2)
Pritesh Shah
il 10 Ott 2016
0 voti
Did you defined the variable xw,yw,rw?
Guillaume
il 10 Ott 2016
Matlab failed to open the file. There may be many reasons for this, the file does not exist / the file is not is in the current directory (since you didn't specify a path) / you don't have read access to the file / something else.
Open the file with
[fid, errmsg] = fopen('file.txt', 'a');
assert(fid > 0, 'Failed to open file because: %s', errmsg);
And see what error you get.
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!