MATLAB: \n Not Generating New Line In fprintf fid Command When Writing To .dat File

appendfidfilefprintfnew linewrite

I have a loop going and am trying to write output each time to a .dat text file appending it every iteration; but not getting a new line.
for minute = 18:1:48
thetaL = 15*(hour+minute/60+second/3600);
h = thetaL-alpha;
a = asin(sin(phi0)*sin(beta)+cos(phi0)*cos(beta)*cos(h));
A = atan((sin(h))/(cos(h)*sin(phi0)-tan(beta)*cos(phi0)));
fid = fopen('astro_conv_table.dat', 'a');
fprintf(fid, '%.0f %s %.0f %s %.0f %.0f %.0f
\n',hour,':',minute,':',second,a,A);
fclose(fid);
end
Everything in the code is working fine except the output is written to file in one long line as opposed to intended new line every iteration.
Thank you.

Best Answer

I assume you are in Windows. The return of carriage for Windows is "\r\n". Try changing that. Otherwise, use wordpad instead of notepad. Or get any decent text editor, like notepad++, which is free.