MATLAB: How to convert a .mat file into tab separated .txt file

convert .mat into text filecsvdlmwritefileformat covnversionmattab separated. file conversiontext;txt

Hello Friends,
I have a data matrix of real entries. I saved this matrix in MATLAB Workspace as .mat file. I want to convert it to tab separated .txt file. For this I tried the following:
load('myFile.mat')
dlmwrite('myFile.txt', myFile, 'delimiter','\t')
it does create a text file which is in notepad with name myFile.txt, however, this .txt file puts all the elements of the 1st row, 2nd row, 3rd row, etc. in one row. I do not even understand what it does. I just wanted it to remain in the same way as before, but just with tab separated and in .txt.
Though when I type the following command, it shows tab separated columns as I wanted in Command Window:
type('myFile.txt')
Please advise!

Best Answer

I found the answer to my own problem. I should have added 'newline','pc' in my command, i.e.,
dlmwrite('myFile.txt', myFile, 'delimiter','\t','newline','pc')
This gives the desired result.