<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="getfield">
    <refnamediv>
        <refname>getfield</refname>
        <refpurpose>リストのフィールドの展開</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>呼び出し手順</title>
        <synopsis>[x,...]=getfield(i,l)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>パラメータ</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>任意の型の行列</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>l</term>
                <listitem>
                    <para>list, tlist または mlist変数</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>i</term>
                <listitem>
                    <para>フィールド添え字, 詳細は extraction 参照.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>説明</title>
        <para>
            この関数は, フィールド展開用の <literal>[x,...]=l(i)</literal> 構文と等価ですが,
            唯一の違いは, <literal>mlist</literal> オブジェクトにも適用できる
            ことです.
        </para>
    </refsection>
    <refsection>
        <title>例</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>参照</title>
        <simplelist type="inline">
            <member>
                <link linkend="extraction">extraction</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
