MATLAB Answers

write text in file

5 views (last 30 days)
Yusuf lamah
Yusuf lamah on 11 Feb 2020
Commented: Yusuf lamah on 15 Feb 2020
how i can wtite or save output "text message' in file.txt

  0 Comments

Sign in to comment.

Accepted Answer

Bhaskar R
Bhaskar R on 11 Feb 2020
Edited: Bhaskar R on 11 Feb 2020
txt = 'text message';
fid = fopen('file.txt', 'wt');
fprintf(fid,'%s', txt);
fclose(fid);

  8 Comments

Show 5 older comments
Yusuf lamah
Yusuf lamah on 11 Feb 2020
ok i will send it when i get my lab top i am using phone now
Rik
Rik on 11 Feb 2020
You may have to use UTF-8 encoding explicitly when writing non-English text.
Yusuf lamah
Yusuf lamah on 15 Feb 2020
thanks alot for all its ok

Sign in to comment.

More Answers (1)

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

  0 Comments

Sign in to comment.

Tags

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!