Function Reference
— Built-in Function: sprintf (template, ...)

This is like printf, except that the output is returned as a string. Unlike the C library function, which requires you to provide a suitably sized string as an argument, Octave's sprintf function returns the string, automatically sized to hold all of the items converted.

See also: printf fprintf sscanf