1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
4
<LANGUAGE>eng</LANGUAGE>
6
<TYPE>Scilab Function</TYPE>
8
<SHORT_DESCRIPTION name="mfprintf"> converts, formats, and writes data to a file</SHORT_DESCRIPTION>
9
<SHORT_DESCRIPTION name="mprintf"> converts, formats, and writes data to the main scilab window</SHORT_DESCRIPTION>
10
<SHORT_DESCRIPTION name="msprintf"> converts, formats, and writes data in a string</SHORT_DESCRIPTION>
12
<CALLING_SEQUENCE_ITEM>mfprintf(fd,format,a1,...,an); </CALLING_SEQUENCE_ITEM>
13
<CALLING_SEQUENCE_ITEM>mprintf(format,a1,...,an); </CALLING_SEQUENCE_ITEM>
14
<CALLING_SEQUENCE_ITEM>str=msprintf(format,a1,...,an); </CALLING_SEQUENCE_ITEM>
19
<PARAM_NAME>fd</PARAM_NAME>
21
<SP>: scalar, file descriptor given by <VERB>mopen</VERB> (it's a positive integer). The value <VERB>-1</VERB> refers to the default file ( i.e the last opened file).</SP>
25
<PARAM_NAME>format</PARAM_NAME>
27
<SP>: a Scilab string describing the format to use to write the remaining operands. The format operand follows, as close as possible, the C printf format operand syntax.</SP>
31
<PARAM_NAME>str</PARAM_NAME>
33
<SP>: a character string, string to be scanned.</SP>
37
<PARAM_NAME>a1,...,an</PARAM_NAME>
39
<SP>: Specifies the data to be converted and printed according to the format parameter.</SP>
46
The <VERB>mprintf</VERB>, <VERB>mfprintf</VERB>, and <VERB>msprintf</VERB> functions are interface for C-coded version of <VERB>printf</VERB>, <VERB>fprintf</VERB> and
47
<VERB>sprintf</VERB> functions.</P>
49
The <VERB>mprintf</VERB> function
50
writes formatted operands to the standard Scilab output
51
(i.e the Scilab window). The argument operands are formatted under control
52
of the format operand.</P>
54
The <VERB>mfprintf</VERB> function writes formatted operands to the file
55
specified by the file desciptor
56
<VERB>fd</VERB>. The argument operands are formatted under control
57
of the format operand.</P>
59
The <VERB>msprintf</VERB>
60
writes formatted operands in its returned value (a Scilab string).
61
The argument operands are formatted under control
62
of the format operand. Note that, in this case, the escape
63
sequences (<VERB>"\n, \t,.."</VERB>) are treated as a normal sequence of
66
All these functions may be used to output column vectors of numbers
67
and string vectors without an explicit loop on the elements. In that
68
case these functions iterates on the rows. The shortest vector gives
69
the number of time the format has to be iterated.</P>
71
An homogeneous sequence of identical type parameters can be
72
replaced by a matrix</P>
76
mprintf('At iteration %i, Result is:\nalpha=%f',33,0.535)
78
msprintf('%5.3f %5.3f',123,0.732)
79
msprintf('%5.3f\n%5.3f',123,0.732)
82
// vectorized forms: the format directive needs
83
// two operand, each column of A is used as an operand.
84
// and the mprintf function is applied on each row of A
85
mprintf('%5.3f\t%5.3f\n',A)
87
colors=['red';'green';'blue';'pink';'black'];
88
RGB=[1 0 0;0 1 0;0 0 1;1 0.75 0.75;0 0 0];
89
mprintf('%d\t%s\t%f\t%f\t%f\n',(1:5)',colors,RGB)
101
<LINK>mfprintf</LINK>
104
<LINK>fprintfMat</LINK>
110
<LINK>fscanfMat</LINK>