MATLAB: Fprintf output line break

fprintf output text str

Hi all,
I am writing a code where under a string is generated and stored in an array.
After the array is stored, I use fprintf to write the array into an data file, and then later on the string within the array is replaced within a new string and the cycle repeats.
The problem I am having is that I have been unable to make each fprintf cmd to print in a new line in the output file so I get something looking like this:
dataline dataline dataline dataline dataline dataline dataline
…instead of this:
dataline
dataline
dataline
dataline
dataline
I've been tinkering with formatting but I still can't get it right. Can any one help me?
Thanks!!!

Best Answer

fprintf(fid, '%s\n', TheString);