MATLAB: Write 2 values to file in the same row

MATLABwrite several values to single line of output file

I have 2 values (out1 and out2) I want to write to a file without skipping a line. I have tried the following code but out1 is on the first line and out2 is on the second line.
fid = fopen('exp.txt','w');
fprintf(fid,[out1 out2]);
fclose(fid);

Best Answer

Try adding a format specifier
fprintf(fid, '%f, ', [out1, out2]);