File: read.xml

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (138 lines) | stat: -rw-r--r-- 5,185 bytes parent folder | download
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
<?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-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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="read">
  <info>
    <pubdate>$LastChangedDate$</pubdate>
  </info>
  <refnamediv>
    <refname>read</refname>
    <refpurpose> matrices read</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <title>Calling Sequence</title>
    <synopsis>[x]=read(file-desc,m,n,[format])
[x]=read(file-desc,m,n,k,format)</synopsis>
  </refsynopsisdiv>
  <refsection>
    <title>Parameters</title>
    <variablelist>
      <varlistentry>
        <term>file-desc</term>
        <listitem>
          <para>character string specifying the file name or integer value specifying logical unit (see file).</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>m, n</term>
        <listitem>
          <para>integers (dimensions of the matrix x). Set m=-1 if you do not know the numbers of rows, so the whole file is read.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>format : character string, specifies a "Fortran" format. This</term>
        <listitem>
          <para>character string must begin with a right parenthesis and end with a left parenthesis.  Formats cannot mix floating point or character edition modes.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>k</term>
        <listitem>
          <para>integer or vector of integer</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsection>
  <refsection>
    <title>Description</title>
    <para>
    reads row after row
    the <literal>mxn</literal> matrix <literal>x</literal> (<literal>n=1</literal> for character chain) in the
    file <literal>file-desc</literal> (string or integer).  Each row of the matrix <literal>x</literal>
    begin in a new line of <literal>file-desc</literal> file. Depending on <literal>format</literal>, a
    given row of the <literal>x</literal> matrix may be read from more than one line
    of <literal>file-desc</literal> file.</para>
    <para>
    The type of the result will depend on the specified format. 
    If format contains only <literal>(d,e,f,g)</literal>  descriptors the function
    tries to read numerical data (the result is matrix of real numbers).</para>
    <para>
    If format contains only  <literal>a</literal> descriptors the function tries to
    read character strings (the result is a character string column
    vector). In this case n must be equal to 1. Warning: The character strings are
      truncated when they are longuer than 4093.</para>
    <para>
    Examples for <literal>format</literal>:</para>
    <programlisting role = ""><![CDATA[ 
(1x,e10.3,5x,3(f3.0))
(10x,a20) 
 ]]></programlisting>
    <para>
    When format is omitted datas are read using numerical free format: 
    blank, comma and slash may be used as data separators, n*v may be use
    to represent n occurrences of value n.</para>
    <para>
    A direct access file can be used if using the parameter <literal>k</literal> which is 
    is the vector of record numbers to be read (one record per row),
    thus <literal>m</literal> must be <literal>m=prod(size(k))</literal>.</para>
    <para>
    To read on the keyboard use <literal>read(%io(1),...)</literal>.</para>
  </refsection>
  <refsection>
    <title>Remark</title>
    <para>
    Last line of data files must be terminated by a newline to be taken into account.</para>
  </refsection>
  <refsection>
    <title>Examples</title>
    <programlisting role="example"><![CDATA[ 
if MSDOS then unix('del foo');
else unix('rm -f foo'); end
A=rand(3,5); write('foo',A);
B=read('foo',3,5)
B=read('foo',-1,5)
read(%io(1),1,1,'(a)')  // waits for user's input
 ]]></programlisting>
  </refsection>
  <refsection>
    <title>See Also</title>
    <simplelist type="inline">
      <member>
        <link linkend="write">write</link>
      </member>
      <member>
        <link linkend="write">load</link>
      </member>
      <member>
        <link linkend="file">file</link>
      </member>
      <member>
        <link linkend="readb">readb</link>
      </member>
      <member>
        <link linkend="x_dialog">x_dialog</link>
      </member>
      <member>
        <link linkend="mscanf">mscanf</link>
      </member>
      <member>
        <link linkend="mfscanf">mfscanf</link>
      </member>
      <member>
        <link linkend="msscanf">msscanf</link>
      </member>
      <member>
        <link linkend="fscanfMat">fscanfMat</link>
      </member>
    </simplelist>
  </refsection>
</refentry>