Info

この質問は閉じられています。 編集または回答するには再度開いてください。

saving data to the file

1 ビュー (過去 30 日間)
Artur Lipnicki
Artur Lipnicki 2016 年 10 月 10 日
終了済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
José-Luis
José-Luis 2016 年 10 月 10 日
What's the value of fid?
Do you have write access to the current folder?

回答 (2 件)

Pritesh Shah
Pritesh Shah 2016 年 10 月 10 日
Did you defined the variable xw,yw,rw?

Guillaume
Guillaume 2016 年 10 月 10 日
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.

Community Treasure Hunt

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

Start Hunting!

Translated by