write text in file

5 次查看(过去 30 天)
Yusuf lamah
Yusuf lamah 2020-2-11
how i can wtite or save output "text message' in file.txt

采纳的回答

Bhaskar R
Bhaskar R 2020-2-11
编辑:Bhaskar R 2020-2-11
txt = 'text message';
fid = fopen('file.txt', 'wt');
fprintf(fid,'%s', txt);
fclose(fid);
  8 个评论
Rik
Rik 2020-2-11
You may have to use UTF-8 encoding explicitly when writing non-English text.
Yusuf lamah
Yusuf lamah 2020-2-15
thanks alot for all its ok

请先登录,再进行评论。

更多回答(1 个)

fred  ssemwogerere
fred ssemwogerere 2020-2-11
You can use fprintf. The link below should give you more clarity based on the data you are saving:

类别

Help CenterFile Exchange 中查找有关 Language Support 的更多信息

标签

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by