What exactly are you doing?
You do not tell us if you are reading this file into MATLAB, and if so with what functions, or if you are writing it by appending text to a file, or doing some other text-parsing operations... are we supposed to guess what you are doing and how you are doing it? Without seeing your code, how do we know what you have tried, and what could be changed to make it work?
You write that "Everything works fine"... but nowhere do you tell us exactly what that Everything is.
Please help us by reading this: