MATLAB: What is the syntax of fprintf? Suppose there are two flot numbers 1 and 2, and F_ID is the file identifier. Write the command to sabe the two numbers to F_ID

What is the syntax of fprintf? Suppose there are two flot numbers 1 and 2, and F_ID is the file identifier. Write the command to sabe the two numbers to F_ID?

Best Answer

fprintf(F_ID, '%1.1f %1.1f\n', X)
where X has two columns. X is the variable in the MATLAB workspace contain the numbers.
Or
fprintf(F_ID, '%1.1f %1.1f\n', a,b)
where a = 1.0 and b = 2.0