the code below displays at the matlab command panel perfectly well
fprintf('%f\n%f\n%f\n',MDR,TER,FAR);
each variable is displayed as new line
but when i try this way and check the newly made text file via notepad i don’t see any new lines
fileID=fopen('my_file.txt','w');
fprintf(fileID,'%f\n%f\n%f\n',MDR,TER,FAR);
fclose(fileID);
what might be the problem ? at the text file all variables are written without any new line or space
thank you
From the backslash in the filename I assume that you are working on a windows platform. Unix and Windows use different new line characters. Windows uses
\r\nas new line while Linux and OSX use\n. Matlab on the other hand uses Unix new lines in the command panel.You might want to use
dlmwriteto write your text files. This is generally more reliable and faster thanfprintf.Example:
the important part is that the input
[MDR;TER;FAR]is a matrix. Every row will be on a new line and the columns are separated by the standard delimeter,.