[doc] gettext printf_conversion mprintf msprintf mfprintf pages updated & fixed
[scilab.git] / scilab / modules / output_stream / help / ja_JP / mprintf.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * ...
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  * Copyright (C) 2021 - Samuel GOUGEON
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"
18           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
19           xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
20           xml:id="mprintf" xml:lang="ja">
21     <refnamediv>
22         <refname>mprintf</refname>
23         <refpurpose>
24             変換, 整形し,
25             Scilab主ウインドウにデータを書き込む
26         </refpurpose>
27     </refnamediv>
28     <refnamediv xml:id="printf">
29         <refname>printf</refname>
30         <refpurpose>
31             変換, 整形し,
32             Scilab主ウインドウにデータを書き込む (廃止)
33         </refpurpose>
34     </refnamediv>
35     <refsynopsisdiv>
36         <title>呼び出し手順</title>
37         <synopsis>mprintf(format,a1,...,an);</synopsis>
38     </refsynopsisdiv>
39     <refsection>
40         <title>パラメータ</title>
41         <variablelist>
42             <varlistentry>
43                 <term>format</term>
44                 <listitem>
45                     <para>
46                         残りのオペランドを書く際のフォーマットを定義するScilab文字列.
47                         formatオペランドは,C言語のprintfのformatオペランドと
48                         構文にできるだけ近くなるよう作成されています, as described in the
49                         <link linkend="printf_conversion">printf_conversion</link> page.
50                         UTF-8 extended characters and numbered placeholders "%n$.." are supported.
51                     </para>
52                 </listitem>
53             </varlistentry>
54             <varlistentry>
55                 <term>a1,...,an</term>
56                 <listitem>
57                     <para>
58                         formatパラメータに基づき変換,出力されるデータを定義します.
59                         Supported types: all numbers, booleans, strings. Only the real part
60                         of complex numbers is considered (current Scilab limitation).
61                     </para>
62                 </listitem>
63             </varlistentry>
64         </variablelist>
65     </refsection>
66     <refsection>
67         <title>説明</title>
68         <para>
69             <literal>mprintf(format, a1, a2, ..)</literal> replaces placeholders provided inside the
70             <varname>format</varname> string with values of <varname>a1</varname>, <varname>a2</varname>, ..
71             converted according to each respective placeholder directive, and writes the result to
72             the Scilab console.
73         </para>
74         <para>
75             If <varname>a1</varname>, <varname>a2</varname>, .. are arrays with multiple rows,
76             they are processed row by row: the format is used iteratively for every row of the
77             arrays (horizontally "concatenated"), until the bottom
78             of the least tall array is reached. Remaining rows of taller arrays (if any) are ignored.
79             See examples.
80         </para>
81         <para>
82             If the total number of columns of <varname>a1</varname>, <varname>a2</varname>, ..
83             is bigger than the number of placeholders in the <varname>format</varname>,
84             then extra columns are ignored.
85         </para>
86         <para>
87             The <literal>mprintf</literal> function is an extended interface for C-coded
88             <literal>printf</literal>.
89         </para>
90     </refsection>
91     <refsection>
92         <title>例</title>
93         <programlisting role="example"><![CDATA[
94 I = (1:4)';
95 A = [26.93 ; 63.25 ; 40.51 ; 91.84];
96 B = [ 3.62 ; 15.04 ; 25.3  ; 48.19];
97 C = [ 4.37   28.06
98      48.18   %inf
99      41.48   %nan
100      26.39   77.83];
101 Status = ["NOK" "NOK" "NOK" "OK"]';
102 Format = "Iteration %d: Results: A= %f   B= %2d%%  Status= %3s   C(1)= %g  C(2)= %e\n";
103 mprintf(Format, I, A, B, Status, C);
104      ]]></programlisting>
105         <screen><![CDATA[
106 --> mprintf(Format, I, A, B, Status, C);
107 Iteration 1: Results: A= 26.930000   B=  3%  Status= NOK   C(1)= 4.37  C(2)= 2.806000e+01
108 Iteration 2: Results: A= 63.250000   B= 15%  Status= NOK   C(1)= 48.18  C(2)= Inf
109 Iteration 3: Results: A= 40.510000   B= 25%  Status= NOK   C(1)= 41.48  C(2)= Nan
110 Iteration 4: Results: A= 91.840000   B= 48%  Status=  OK   C(1)= 26.39  C(2)= 7.783000e+01
111 ]]></screen>
112         <para/>
113         <para>
114             Supernumerary columns or rows are ignored:
115         </para>
116         <programlisting role="example"><![CDATA[
117 A = [%T  %F  %T  %T  %F]';
118 B = [ 4.37   28.06
119      48.18   %inf
120      41.48   %nan ];
121 mprintf("OK? %s  Value: %4.1f\n", A, B);
122      ]]></programlisting>
123         <screen><![CDATA[
124 --> mprintf("OK? %s  Value: %4.1f\n", A, B);
125 OK? T  Value:  4.4
126 OK? F  Value: 48.2
127 OK? T  Value: 41.5
128 ]]></screen>
129         <para/>
130         <para>
131             Numbered placeholders "%n$.." allow reordering printed data with the format:
132         </para>
133         <programlisting role="example"><![CDATA[
134 names = ["Peter", "Martha" "John"]';
135 ages  = [32 25 8]';
136 mprintf("%2$6s is %1$d-year old.\n", ages, names);
137      ]]></programlisting>
138         <screen><![CDATA[
139 --> mprintf("%2$6s is %1$d-year old.\n", ages, names);
140  Peter is 32-year old.
141 Martha is 25-year old.
142   John is 8-year old.
143 ]]></screen>
144     </refsection>
145     <refsection role="see also">
146         <title>参照</title>
147         <simplelist type="inline">
148             <member>
149                 <link linkend="printf_conversion">printf_conversion</link>
150             </member>
151             <member>
152                 <link linkend="disp">disp</link>
153             </member>
154             <member>
155                 <link linkend="write">write</link>
156             </member>
157             <member>
158                 <link linkend="percentio">percentio</link>
159             </member>
160             <member>
161                 <link linkend="percentchars">percentchars</link>
162             </member>
163         </simplelist>
164     </refsection>
165     <refsection role="history">
166         <title>履歴</title>
167         <revhistory>
168             <revision>
169                 <revnumber>6.1.0</revnumber>
170                 <revdescription>
171                     Numbered placeholders "%n$.." are supported in the format.
172                 </revdescription>
173             </revision>
174             <revision>
175                 <revnumber>6.1.1</revnumber>
176                 <revdescription>
177                     Input data can be boolean.
178                 </revdescription>
179             </revision>
180         </revhistory>
181     </refsection>
182 </refentry>