fdf865854b274af674167d026c633136cf49a20f
[scilab.git] / scilab / modules / data_structures / help / en_US / setfield.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) 2006-2008 - INRIA
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <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" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="setfield">
17     <refnamediv>
18         <refname>setfield</refname>
19         <refpurpose>list field insertion</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>a = setfield(i, x, l)</synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>x</term>
30                 <listitem>
31                     <para>a matrix of any possible types.</para>
32                 </listitem>
33             </varlistentry>
34             <varlistentry>
35                 <term>l</term>
36                 <listitem>
37                     <para>
38                         a <literal>list</literal>, <literal>tlist</literal> or <literal>mlist</literal> variable.
39                     </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>i</term>
44                 <listitem>
45                     <para>
46                         a field index, see <link linkend="insertion">insertion</link> for more details.
47                     </para>
48                 </listitem>
49             </varlistentry>
50             <varlistentry>
51                 <term>a</term>
52                 <listitem>
53                     <para>
54                         Updated variable.
55                     </para>
56                 </listitem>
57             </varlistentry>
58         </variablelist>
59     </refsection>
60     <refsection>
61         <title>Description</title>
62         <para>
63             This function is an equivalent of <code>l(i)=x</code> syntax for field
64             extraction with the only difference that it also applies to
65             <literal>mlist</literal> objects.
66         </para>
67     </refsection>
68     <refsection>
69         <title>Examples</title>
70         <programlisting role="example"><![CDATA[
71 l=list(1,'qwerw',%s)
72 l(1)='Changed'
73 l(0)='Added'
74 l(6)=['one more';'added']
75 l=setfield(5,"added by setfield", l)
76  ]]></programlisting>
77     </refsection>
78     <refsection role="see also">
79         <title>See also</title>
80         <simplelist type="inline">
81             <member>
82                 <link linkend="insertion">insertion</link>
83             </member>
84         </simplelist>
85     </refsection>
86     <refsection>
87         <title>History</title>
88         <revhistory>
89             <revision>
90                 <revnumber>6.0.0</revnumber>
91                 <revdescription>
92                     setfield returns variable updated instead of change it "in place".
93                 </revdescription>
94             </revision>
95         </revhistory>
96     </refsection>
97 </refentry>