<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) ENPC - Jean-Philippe Chancelier
 *
 * 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="xsave">
    <refnamediv>
        <refname>xsave</refname>
        <refpurpose>save graphics into a
            file
        </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>xsave(filename,[win_num])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>file_name</term>
                <listitem>
                    <para>string, name of the file.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>win_num</term>
                <listitem>
                    <para>integer, the graphics window number. If not given, the current
                        graphics window is used.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>xsave</literal> saves the graphics contained in the graphics window
            <literal>win_num</literal> in the binary file <literal>file_name</literal>. and can be
            reloaded with <literal>xload</literal>.
        </para>
        <para>
            Since  Scilab 5.0, all <link linkend="uimenu">uimenu</link> or <link linkend="uicontrol">uicontrol</link> handles are also saved.
        </para>
        <para>
            For graphics <literal>xsave(file_name,win_num)</literal> use preferably
            <literal>save(file_name,scf(win_num))</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
t=0:0.01:10;
subplot(211),plot2d(t,sin(t))
subplot(212),plot2d(t,sin(3*t))
xsave(TMPDIR + "/foo.scg", gcf())
clf()
xload(TMPDIR + "/foo.scg")

a=gca();
curve=a.children.children; //handle on the curve
save(TMPDIR + "/foo.scg", "curve")
delete(curve)
load(TMPDIR + "/foo.scg")
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="xload">xload</link>
            </member>
            <member>
                <link linkend="save">save</link>
            </member>
            <member>
                <link linkend="load">load</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
