<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA - Serge STEER
 * ...
 *
 * 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="fileparts">
    <refnamediv>
        <refname>fileparts</refname>
        <refpurpose>returns the path, filename and extension for a file path</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[path, fname, extension] = fileparts(fullpath)
            value = fileparts(fullpath, sel)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>fullpath</term>
                <listitem>
                    <para> a string or a string matrix, the given file path.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>sel</term>
                <listitem>
                    <para>a optional character string selector, with possible values:
                        <literal>'path'</literal>, <literal>'fname'</literal> or <literal>'extension'</literal>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>path</term>
                <listitem>
                    <para>
                        a string or a string matrix, the path of the directory pointed to by <varname>fullpath</varname>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>fname</term>
                <listitem>
                    <para>
                        a string or a string matrix, the filename part is any or <literal>''</literal>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>extension</term>
                <listitem>
                    <para>
                        a string or a string matrix, the extension part is any or <literal>''</literal>.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>value</term>
                <listitem>
                    <para>
                        a string or a string matrix, depending on <varname>sel</varname> value.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <code>[path, fname, extension] = fileparts(fullpath)</code> splits the
            <varname>fullpath</varname> character string in its three parts: the path of the
            directory pointed to, the filename part, the extension part
            including the dot.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
[path,fname,extension]=fileparts('SCI/etc/scilab.start')
fileparts('SCI/etc/scilab.start','extension')
[path,fname,extension]=fileparts(['SCI/etc/scilab.start', 'SCI/etc/scilab.start'])
fileparts(['SCI/etc/scilab.start', 'SCI/etc/scilab.start'],'extension')
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="pathconvert">pathconvert</link>
            </member>
            <member>
                <link linkend="basename">basename</link>
            </member>
            <member>
                <link linkend="fullfile">fullfile</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
