How do I write to a .txt file?

9 views (last 30 days)
Jake
Jake on 25 Jan 2014
Answered: Walter Roberson on 25 Jan 2014
I need to write to a .txt file.
Thank you for your help.

Answers (2)

Walter Roberson
Walter Roberson on 25 Jan 2014
fid = fopen('YourFile.txt', 'wt');
fprintf(fid, 'Jake said: %f\n', sqrt(1:10));
fclose(fid);

G PRAKASH
G PRAKASH on 25 Jan 2014
use dlmwrite command
I=magic(10); dlmwrite('file.txt',I)

Community Treasure Hunt

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

Start Hunting!