1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) XXXX-2008 - INRIA
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
-->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="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="write" xml:lang="en">
<refnamediv>
<refname>write</refname>
<refpurpose>write in a formatted file</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>write(file-desc,a,[format])
write(file-desc,a,k,format)
</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
<term>file-desc</term>
<listitem>
<para>character string specifying the file name or integer value
specifying logical unit (see file).
</para>
<para>This function can not open a UTF filename. In this case,
please uses mopen.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>a</term>
<listitem>
<para>real matrix or column vector of character strings.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>format</term>
<listitem>
<para>character string, specifies a "Fortran" format. This character
string must begin with a right parenthesis and end with a left
parenthesis. Formats cannot mix floating point , integer or
character edition modes
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>k</term>
<listitem>
<para>integer vector</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para>writes row-by-row a real matrix or a column vector of character
strings in a formatted file. Each row of the <literal>a</literal> argument
begin in a new line of <literal>file-desc</literal> file. Depending on
<literal>format</literal> a given row of the <literal>a</literal> argument
may be written in more than one line of <literal>file-desc</literal>
file.
</para>
<para>
Format examples : <literal>(1x,e10.3,5x,3(f3.0))</literal> ,
<literal>(10x,a20)</literal> ;
</para>
<para>See a Fortran book for more precision.</para>
<para>Direct access files :
<literal>x=write(file_desc,a,k,format)</literal>. Here
<literal>k</literal> is the vector of records (one record by row, i.e.
<literal>m=prod(size(k)</literal>)
</para>
<para>
<literal>write(%io(2),....)</literal> writes on Scilab's window.
Note that in this case <literal>format</literal> should produce one output
line per matrix row. If this contraint is not verified unpredictable
behavior could happen.
</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
if getos() == 'Windows' then unix('del asave');
else unix('rm -f asave'); end
A=rand(5,3); write('asave',A); A=read('asave',5,3);
write(%io(2),A,'('' | '',3(f10.3,'' | ''))')
write(%io(2),string(1:10))
write(%io(2),strcat(string(1:10),','))
write(%io(2),1:10,'(10(i2,3x))')
if getos() == 'Windows' then unix('del foo');
else unix('rm -f foo'); end
write('foo',A)
]]></programlisting>
</refsection>
<refsection role="see also">
<title>See Also</title>
<simplelist type="inline">
<member>
<link linkend="read">read</link>
</member>
<member>
<link linkend="save">save</link>
</member>
<member>
<link linkend="file">file</link>
</member>
<member>
<link linkend="fileinfo">fileinfo</link>
</member>
<member>
<link linkend="writb">writb</link>
</member>
<member>
<link linkend="print">print</link>
</member>
<member>
<link linkend="string">string</link>
</member>
<member>
<link linkend="mfprintf">mfprintf</link>
</member>
<member>
<link linkend="mprintf">mprintf</link>
</member>
<member>
<link linkend="msprintf">msprintf</link>
</member>
<member>
<link linkend="fprintfMat">fprintfMat</link>
</member>
</simplelist>
</refsection>
</refentry>
|