I'm trying to append new lines to a .txt
file in a loop with MATLAB as follows:
for i=1:N
% do something
% something done. write them to text file:
fid = fopen(outfile, 'a');
for j = 1:numel(smth.text)
fprintf(fid, '\n%s;%d', smth.text{j}, smth.data(j));
end
fclose(fid);
end
when I'm finished, I open the file in Notepad++ (if relevant, the encoding is UTF-8) and see it correctly, i.e.:
text1;data1
text2;data2
etc
however, when I open the file in Windows' Notepad, I see it like this:
text1;data1text2;data2etc
so the line breaks are not showing up in Notepad.
How can I fix this so I can get the newlines everywhere?
Thanks for any help,