MATLAB: Print a matrix in output file

matrix

Good morning\evening
I tried to print a result matrix R in an output file.
fprintf(fid,'%.3f\t\n %.3f\t\n %.3f\t\n',R);
Actually, the output prints the matrix row by row.
Can you help me?
Regards, Ayda

Best Answer

Each of the \n in the formats indicates that you want to start a new line.
The \t you have indicate that you want a tab before the newline; that would be somewhat unusual.
Anyhow, you should use R.' (the transpose of R) as the argument to fprintf() instead of just R