save a fprintf as text file

24 ビュー (過去 30 日間)
Niklas Reinshagen
Niklas Reinshagen 2020 年 5 月 24 日
コメント済み: Niklas Reinshagen 2020 年 5 月 25 日
Hey, I've wrote a line of code wich displays the percentage of the Earth Layers Volume.
fprintf('\nPercentage of the EarthLayer:\nCore: %.1f%%\nMantle: %.1f%%\nCrust: %.1f%%\n\n',PercentCore,PercentMantle,PercentCrust)
The Problem is, when i use the save command, is stores a text file but only with the number 74 in it... How can I fix this problem? It should be stores in the way it is displayd under the fprintf-Command code line.
  1 件のコメント
Star Strider
Star Strider 2020 年 5 月 24 日

サインインしてコメントする。

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 5 月 24 日
fid=fopen('MyTextFile.txt','wt');
fprintf(fid,...);
fclose(fid);
  1 件のコメント
Niklas Reinshagen
Niklas Reinshagen 2020 年 5 月 25 日
Thank you very much! Very easy to use! Just type the title for "MyTextFile.txt", "wt"-means "write", the blue dots after "fid" are the fprintf-command and the fid just defines that this should be stored in a file.
Very Cool, thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by