how i can wtite or save output "text message' in file.txt

 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

thank you very much it working but some text missing nit all text and not identical to output why?
Bhaskar R
Bhaskar R on 11 Feb 2020
What are you getting?
not exact text there are some letters repleced with symbols like'?' and not all text saved maybe my text bit about more 1000 character
may text long
Bhaskar R
Bhaskar R on 11 Feb 2020
"may text long" - Can you provide that text?
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.
thanks alot for all its ok

Sign in to comment.

More Answers (1)

fred  ssemwogerere
fred ssemwogerere on 11 Feb 2020

0 votes

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

Categories

Products

Release

R2016a

Tags

Community Treasure Hunt

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

Start Hunting!