Hi!
I am very sorry to post this question, because it has already been answered multiple times in this forum. Unfortunately, the presented solution doesn't work for me. So, I am wondering what's going wrong.
I want to write some parameters in a .tex file. Following the hints in the mentioned posts, I opened my testfile with the option 'wt' to make sure that my newlines '\n' are recognized
fid1 = fopen('Testfile.txt','wt');
fprintf(fid1,'%s','abc');
fprintf(fid1,'%s','\n');
fprintf(fid1,'%s','def');
fprintf(fid1,'%s','\n');
fprintf(fid1,'%s','ghi \n jkl');
fclose(fid1);
But, independently of what I do, I obtain
abc\ndef\nghi \n klm
once I open 'Testfile.txt'.
Opening the file with 'w' and using additonally '\r' doesn't work either.
So, I am grateful for any hints that might help solving the problem!
Thank you in advance!
2 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/662103-newline-in-text-files#comment_1160403
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/662103-newline-in-text-files#comment_1160403
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/662103-newline-in-text-files#comment_1160438
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/662103-newline-in-text-files#comment_1160438
Sign in to comment.