file write problem
The made a below script.
When I see the read3.txt file it has different show.
['notepad program']
It doesn't have a line change.
['notepad++ program']
It has a line change
How can I make a read3.txt file to be read same as 'notepad++ program' at 'notepad program'.
file = 'read3.txt';
fid = fopen(file, 'w');
AA=[1,2;3,4;5,6];
for i=1:3
fprintf(fid,'%f %f \n', AA(i,:));
end
fclose(fid);
Answers
-
This is because Notepad can only properly display files with Windows newline (CR+LF).
The code you use produces UNIX newline (LF only).
In Notepad++, you can control which end-of-line is used in your file by going to Edit > EOL Conversion. The greyed entry is your current end-of-line.
To make Compose write a Windows EOL, that will be displayed as you expect in Notepad, please use the following code:
file = 'read3.txt';
fid = fopen(file, 'w');
AA=[1,2;3,4;5,6];
for i=1:3
fprintf(fid,'%f %f \r\n', AA(i,:));
end
fclose(fid);0 -
Thank you Matthieu Pupat.
0