For example
>> printf("e = %g, pi = %g\n", e, pi); e = 2.71828, pi = 3.14159
If f is a file, then it has a printf attribute function. For example,
>> f.printf("e = %g, pi = %g\n", e, pi);will write the string e = 2.71828, pi = 3.14159 to the file. Alternatively, we can also use the built-in function fprintf to write a formated string to a file
>> fprintf(f, "e = %g, pi = %g\n", e, pi);