Just wanna let you know. I resolved this issue by using
fid=fopen(filename,'wt')
Instead of
fid=fopen(filename,'w')
because the *.ats file requires the ending character of a line to be '\r\n'.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!