Search code examples
matlabcarriage-return

no carriage return while using dlmwrite( ) to write array values to file in Matlab


I am trying to write the array values to CSV file in MATLAB using the following code

m=[3 12 15 ; 4 23 565];
dlmwrite('C:\Users\amar-admin\Desktop\abc.txt', m)
type C:\Users\amar-admin\Desktop\abc.txt

the output printed in the console is

3,12,15
4,23,565

but the output in File is

3,12,154,23,565

Solution

  • the issue was solved using .rtf extension

    dlmwrite('C:\Users\amar-admin\Desktop\abc.rtf', m)
    

    But, I still wonder if same is possible to .txt file