The fprintf statement has the following syntax: fprintf([fid], "format", values to be printed) where fid is needed only if you are printing to a file, and in that case, the file have been opened with fopn. The format string is printed as-is (literally) and can have special codes embedded to indicated how the values are to be handled. Each value has to have a corresponding code: %s treat as a string %d treat as an integer %f treat as a floating-point real number %e treat as a real number in scientific notation %g treat as a real number in the more compact form of %f or %e Note that you can also specify the overall output width and the number of decimal places (if a real number) before the Note also that you can embed the following special characters in the format string: \n output a newline character \t output a tab character