I have a cell array of strings called myarray, containing n elements. I want to write the array to a text file called myfile.txt. I want every line in the text file to correspond to one element in the cell.
When I try the following:
fid = fopen('myfile.txt', 'w');
for i=1:n
fprintf(fid, '%s\n', myarray{i});
end
However, this outputs a file without any carriage returns after each element. When I open it in Notepad in Windows, I see just a list of characters which is from the strings in myarray concatenated together. However, I want each string to be on its own line.
What's going on?