1633f141a8c5823eca24bf897d983a9b97eb4fdf
[scilab.git] / scilab / modules / output_stream / help / en_US / msprintf.xml
1 <?xml version="1.0" encoding="windows-1251"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * ...
6  *
7  * Copyright (C) 2012 - 2016 - Scilab Enterprises
8  *
9  * This file is hereby licensed under the terms of the GNU GPL v2.0,
10  * pursuant to article 5.3.4 of the CeCILL v.2.1.
11  * This file was originally licensed under the terms of the CeCILL v2.1,
12  * and continues to be available under such terms.
13  * For more information, see the COPYING file which you should have received
14  * along with this program.
15  *
16  -->
17 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="msprintf" xml:lang="en">
18     <refnamediv>
19         <refname>msprintf</refname>
20         <refpurpose>converts, formats, and writes data in a string</refpurpose>
21     </refnamediv>
22     <refnamediv xml:id="sprintf">
23         <refname>sprintf</refname>
24         <refpurpose>converts, formats, and writes data in a string (obsolete)</refpurpose>
25     </refnamediv>
26     <refsynopsisdiv>
27         <title>Syntax</title>
28         <synopsis>str = msprintf(format,a1,...,an);</synopsis>
29     </refsynopsisdiv>
30     <refsection>
31         <title>Arguments</title>
32         <variablelist>
33             <varlistentry>
34                 <term>format</term>
35                 <listitem>
36                     <para>a Scilab string describing the format to use to write the
37                         remaining operands.
38                     </para>
39                 </listitem>
40             </varlistentry>
41             <varlistentry>
42                 <term>str</term>
43                 <listitem>
44                     <para>a character string.</para>
45                 </listitem>
46             </varlistentry>
47             <varlistentry>
48                 <term>a1,...,an</term>
49                 <listitem>
50                     <para>Specifies the data to be converted and printed according to
51                         the format parameter.
52                     </para>
53                 </listitem>
54             </varlistentry>
55         </variablelist>
56     </refsection>
57     <refsection>
58         <title>Description</title>
59         <para>
60             The <literal>msprintf</literal> writes formatted operands in its
61             returned value (a Scilab string). The argument operands are formatted
62             under control of the format operand.
63         </para>
64         <para>
65             <note>
66                 Note that, in this case, the escape sequences (<literal>"\n"</literal>) (in format)
67                 split string to a matrix of string (see example).
68             </note>
69         </para>
70     </refsection>
71     <refsection>
72         <title>Examples</title>
73         <programlisting role="example"><![CDATA[
74 msprintf('%5.3f %5.3f',123,0.732)
75 msprintf('%5.3f\n%5.3f',123,0.732)
76 msprintf('--%s-\n-%d--',"hello",3)
77 msprintf('%e ', [1;2;3])
78 msprintf('%d %d\n', [1, 2; 3, 4])
79  ]]></programlisting>
80     </refsection>
81     <refsection role="see also">
82         <title>See also</title>
83         <simplelist type="inline">
84             <member>
85                 <link linkend="mprintf">mprintf</link>
86             </member>
87             <member>
88                 <link linkend="printf_conversion">printf_conversion</link>
89             </member>
90         </simplelist>
91     </refsection>
92 </refentry>