1
mprintf Scilab Group Scilab Function mprintf
3
mfprintf - converts, formats, and writes data to a file mprintf -
4
converts, formats, and writes data to the main scilab window msprintf -
5
converts, formats, and writes data in a string
8
mfprintf(fd,format,a1,...,an);
9
mprintf(format,a1,...,an);
10
str=msprintf(format,a1,...,an);
12
fd : scalar, file descriptor given by mopen (it's a positive
13
integer). The value -1 refers to the default file ( i.e the last opened
16
format : a Scilab string describing the format to use to write the
17
remaining operands. The format operand follows, as close as
18
possible, the C printf format operand syntax.
20
str : a character string, string to be scanned.
22
a1,...,an : Specifies the data to be converted and printed according to
26
The mprintf, mfprintf, and msprintf functions are interface for C-coded
27
version of printf, fprintf and sprintf functions.
29
The mprintf function writes formatted operands to the standard Scilab
30
output (i.e the Scilab window). The argument operands are formatted
31
under control of the format operand.
33
The mfprintf function writes formatted operands to the file specified by
34
the file desciptor fd. The argument operands are formatted under
35
control of the format operand.
37
The msprintf writes formatted operands in its returned value (a Scilab
38
string). The argument operands are formatted under control of the format
39
operand. Note that, in this case, the escape sequences ("\n, \t,..") are
40
treated as a normal sequence of characters.
42
All these functions may be used to output column vectors of numbers and
43
string vectors without an explicit loop on the elements. In that case
44
these functions iterates on the rows. The shortest vector gives the
45
number of time the format has to be iterated.
47
An homogeneous sequence of identical type parameters can be replaced by a
51
mprintf('At iteration %i, Result is:\nalpha=%f',33,0.535)
53
msprintf('%5.3f %5.3f',123,0.732)
54
msprintf('%5.3f\n%5.3f',123,0.732)
57
// vectorized forms: the format directive needs
58
// two operand, each column of A is used as an operand.
59
// and the mprintf function is applied on each row of A
60
mprintf('%5.3f\t%5.3f\n',A)
62
colors=['red';'green';'blue';'pink';'black'];
63
RGB=[1 0 0;0 1 0;0 0 1;1 0.75 0.75;0 0 0];
64
mprintf('%d\t%s\t%f\t%f\t%f\n',(1:5)',colors,RGB)
67
mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr,
68
mopen, mprintf, mput, mputstr, mscanf, mseek, mtell