<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2007-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:ns4="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="cell" xml:lang="en">
    <refnamediv>
        <refname>cell</refname>
        <refpurpose>creates a cell array of empty matrices</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
            c = cell()
            c = cell(m1)
            c = cell(m1, m2)
            c = cell(m1, m2, ..., mn)
            c = cell(x)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>
                        a vector containing the dimensions of the cell to create.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>m1, m2, ..., mn</term>
                <listitem>
                    <para>
                        dimensions of the cell to create.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <function>cell</function> returns a cell array of empty matrices.
        </para>
        <variablelist>
            <varlistentry>
                <term>cell()</term>
                <listitem>
                    <para>
                        returns a <literal>(0, 0)</literal> cell array of empty matrices.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>cell(m1)</term>
                <listitem>
                    <para>
                        returns a <literal>(m1, m1)</literal> cell array of empty matrices.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>cell(m1, m2)</term>
                <listitem>
                    <para>
                        returns a <literal>(m1, m2) </literal> cell array of empty matrices.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>cell(m1,m2,..,mn)</term>
                <listitem>
                    <para>
                        creates a <literal>(m1, m2, ..., mn)</literal> cell array of empty matrices.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>cell(x)</term>
                <listitem>
                    <para>
                        returns a cell array of empty matrices with: the first dimension of the cell array is <literal>x(1)</literal>, the second dimension is <literal>x(2)</literal> and so on.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Remarks</title>
        <para>
            <code>cell(x)</code> is not the same size that <varname>x</varname>.
        </para>
        <para>
            <code>cell()</code> is equivalent to <code>cell(0)</code>.
        </para>
        <para>
            If <literal>A</literal> is a cell array, you can access the contents of an element of <literal>A</literal> by using <code>A{m1, m2, ..., mn}</code>. The expression <code>A(1,1) = zeros(2,2)</code> is not valid, the right syntax is
            <code>A{1,1} = zeros(2,2)</code>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
a = cell(3)
b = cell(3,1)
c = cell([2,3,4])

// Assigning cell entries
b = cell(3,1);

// Assigning the first element of b using {}
b{1} = 1:3

// Assigning the second element of b using {}
b{2} = 'Scilab'

// Assigning the third element of b using the 'entries' field
b{3} = poly(1:3,'s')

// Assigning sub-cells
X = cell(3,2);
X{:,1} = b

// Extracting a sub-cell: result is a cell
b{1}
b{1:2}

// Extracting a sub-cell value: result is an array
b{1}

// Dimensions of b as a double value
size(b)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="eye">eye</link>
            </member>
            <member>
                <link linkend="ones">ones</link>
            </member>
            <member>
                <link linkend="zeros">zeros</link>
            </member>
            <member>
                <link linkend="iscell">iscell</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>6.0.0</revnumber>
                <revremark>
                    Fields "entries" and "dims" do not exist anymore.
                    To assign or extract an element, use {}.
                </revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>
