<?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) 2010 - Digiteo - Vincent LIARD
 *
 * 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="en" xml:id="fieldnames">
    <refnamediv>
        <refname>fieldnames</refname>
        <refpurpose>get a tlist, mlist or struct fields names</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>f = fieldnames(lst)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>lst</term>
                <listitem>
                    <para>A tlist, mlist or struct variable.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>f</term>
                <listitem>
                    <para>Strings column vector of fields names.</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            The <function>fieldnames</function> function returns field names
            of a <literal>tlist</literal>, <literal>mlist</literal> or <literal>struct</literal>. <function>fieldnames</function>
            does not work on cells.
        </para>
        <para>
            As said in <link linkend="rational">rational</link> or <link linkend="syslin">syslin</link> help pages, internal representation of
            some Scilab objects is a tlist (or rlist), so using <function>fieldnames</function> with them will return the generic forms of these objects.
            For example, for rationals, the function will return "num","den" and "dt".
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example">
            fieldnames(tlist(['listtype', 'f1', 'f2'], [], []))
            fieldnames(mlist(['V', 'key', 'value'], ['a' 'b' ; 'c' 'd'], [1 2 ; 3 4]))
            fieldnames(struct('f1', 25, 'month', 'DEC', 'year', 2006))
            obj.x = 3;
            obj.y = 3;
            fieldnames(obj)
            fieldnames(1/%s)
            fieldnames(tf2ss(1/%s))
        </programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="extraction">extraction</link>
            </member>
            <member>
                <link linkend="getfield">getfield</link>
            </member>
            <member>
                <link linkend="tlist">tlist</link>
            </member>
            <member>
                <link linkend="mlist">mlist</link>
            </member>
            <member>
                <link linkend="struct">struct</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
