MATLAB: Text file has no space between elements – Filename

filename dlmwrite

I am trying to save a matrix (8760 x 1) to a text file. This is my code:
dlmwrite('totalenergy.txt',totalenergy,'delimiter',';','precision',4)
However, the generated text file has no space between the elements. Therefore, I get something like this:
5.845.845.655.776.016.196.286.096.045.283.99 etc.
Any ideas? Also, how can I insert a string variable into the filename of the .txt file? e.g. totalenergy_'X'.txt where X is a variable.

Best Answer

That's where the lines split, and you're probably looking at it in notepad or something. Double-click on it in the Current Folder panel of MATLAB and you'll see it looks normal.