<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2006-2008 - INRIA
 *
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="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="getfield" xml:lang="pt">
    <refnamediv>
        <refname>getfield</refname>
        <refpurpose>extração de campos de listas</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Seqüência de Chamamento</title>
        <synopsis>[x,...] = getfield(i,l)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Parâmetros</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>matriz de qualquer tipo possível </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>l</term>
                <listitem>
                    <para>lista, tlist ou mlist </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>i</term>
                <listitem>
                    <para>índice de campo, ver "extraction" para mais detalhes.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Descrição</title>
        <para>
            Esta função é equivalente à sintaxe <literal>[x,...]=l(i)</literal>
            para extração de campos com a única diferença de que também se aplica a
            objetos <literal>mlist</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Exemplos</title>
        <programlisting role="example"><![CDATA[
l=list(1,'qwerw',%s)
[a,b]=getfield([3 2],l)

// Rationals are encoded as t-lists:
r = [%z/(1-%z) %z^2/(1+%z)]
type(r)
[num, den] = getfield([2 3],r)

// Structures arrays are encoded as M-lists:
s.r = %pi
s.b = %t
s.t = "Scilab"
s(2).t = "Basile"
getfield(2,s)==size(s)
getfield(1,s)(3:5)==fieldnames(s)'
[r,b,t] = getfield([3 4 5],s)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>Ver Também</title>
        <simplelist type="inline">
            <member>
                <link linkend="extraction">extraction</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
