FUNCTION REFERENCE
fprintf
Print formatted text in the console.
Print formatted text in the console.
Syntax
fprintf(format)Syntax
fprintf(format, A, ...)Syntax
fprintf(fid, format, A, ...)Formats like sprintf and prints the result. fid can be 1 (output) or 2 (errors). In the command-line program, fid 2 writes to the error stream (stderr); in the desktop and browser consoles both print to the same output. Text without a final newline stays on the line, and the next output continues it. With an output, n = fprintf(...) returns the number of bytes written (UTF-8 length).
Example
fprintf('%s has %d\n', 'ab', 5) % prints: ab has 5Differences from MATLAB: Other file ids and file output are not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.