Section: Input/Ouput Functions
y = sprintf(format,a1,a2,...).
Here format
is the format string, which is a string that
controls the format of the output. The values of the variables
a_i
are substituted into the output as required. It is
an error if there are not enough variables to satisfy the format
string. Note that this sprintf
command is not vectorized! Each
variable must be a scalar. The returned value y
contains the
string that would normally have been printed. For
more details on the format string, see printf
.
--> l = {}; for i = 1:5; s = sprintf('file_%d.dat',i); l(i) = {s}; end; --> l ans = [file_1.dat] [file_2.dat] [file_3.dat] [file_4.dat] [file_5.dat]