sprintf

Returns a formatted string, based on the format, strformat specified.

Syntax

R = sprintf(strformat, s, ...)

Inputs

strformat
Format for the output string.
Type: string
s, ...
Inputs for sprintf
Type: scalar | string | mat

Outputs

R
Type: string

Examples

String and scalar inputs:
R = sprintf('This is the %s string: %4.5f', 'formatted', 1234.567890123454)
R = This is the formatted string: 1234.56789
Matrix input:
R = sprintf('%d, ',[2,3; 1,-8])
R = 2, 1, 3, -8,