MATLAB: Difference between fprintf(fid, [str, 13 10]) and fprintf(fid, [str, ‘\n’])

\ndatafilefprintf

Hello all,
Today I was constructing datafiles using the fprintf(fid, [str, '\n']) synthaxe (str contains some num2str-ed numerical values)
However the datafiles produced this way weren't properly recognized by the data-reduction software I am supposed to use with those datafiles.
Instead, I tried fprintf(fid, [str, 13 10]) to construct my datafiles…and the data-reduction software was perfectly OK with the datafiles written this way !
Do you know what is the reason of this difference between '\n' and [13 10] output?
Just curiosity
Thanks in advance !
PS: Of course the first thing to say is that my data-reduction software is not so good at importing datafiles…

Best Answer

ASCII 13 is carriage return character. It can be combined with newline (ASCII 10) to move to beginning of next line. Following line will also work
fprintf(fid, [str, '\r\n'])
It is not unreasonable to use both of them together, and your software is following this convention. Read here: https://en.wikipedia.org/wiki/Carriage_return