1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) INRIA -
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="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="length" xml:lang="ja">
18 <refname>length</refname>
19 <refpurpose>オブジェクトの長さ</refpurpose>
23 <synopsis>n=length(M)</synopsis>
31 <para>行列 (通常または多項式または文字列) または
39 <para>整数または整数行列</para>
47 通常または多項式の行列の場合, <literal>n</literal>は
48 <literal>M</literal>の行の数に列の数を乗じた整数になります.
49 (<literal>M</literal>が論理値行列の場合にも有効)
51 <para>文字列からなる行列の場合 (および部分的に文字列の場合)
52 <literal>length</literal>は,
53 文字列の行列<literal>M</literal>のエントリの長さを
54 <literal>n</literal>に返します.
56 <para>リストの長さはリストの中の要素の長さです
57 (<literal>size</literal>でも出力されます).
60 The length of an array M of cells or of structures is the number of elements of the array.
61 It is equivalent to <literal>size(M, "*")</literal>.
64 mlistのlengthはデフォルトでmlistの要素数ですが,
65 オーバーロードすることができます(例参照).
67 関数をオーバーロードする必要がないことに注意してください.
68 さもなくば,<function>length</function>は
72 <literal>length('123')</literal>は <literal>3</literal>となります.
73 <literal>length([1,2;3,4])</literal>は <literal>4</literal>となります.
78 疎行列の<function>length</function>は,
79 行列の最大次元を返し,次元の積ではありません.
81 <code>length(sparse(eye(12,2)))</code>は,
82 <literal>24</literal>)ではなく<code>max(12,2)</code> を返します.
83 疎行列の場合は <literal>size(...,'*')</literal>を使用してください.
89 <programlisting role="example"><![CDATA[
91 length(['hello world',SCI])
94 <programlisting role="example"><![CDATA[
95 a = mlist(["myMlistT" "field1" "field2"],"aexample","bexampleb");
97 // lengthがmlistにオーバーロードされたいない場合のデフォルトの動作は3を返す
98 // mlist型myMlistTのオーバーロード関数を作成
99 function r = %myMlistT_length(M)
103 // length(a.field1)の結果8を返す
106 <refsection role="see also">
108 <simplelist type="inline">
110 <link linkend="size">size</link>
118 <revnumber>5.4.0</revnumber>
120 この関数によりmlist型のオーバーロードが可能となりました.
124 <revnumber>6.0.0</revnumber>
128 The <literal>length()</literal> of any array C of cells was formerly
129 always 3, whatever are the number of dimensions and the sizes of the
130 array. It is now the number of elements of the array at null depth
131 (without recursive counting), equal to <literal>size(C, "*")</literal>.
134 The <literal>length()</literal> of any array S of structures was formerly
135 equal to its number of fields +2, whatever are the number of dimensions
136 and the sizes of the array. It is now the number of elements of the
137 array at null depth, equal to <literal>size(S, "*")</literal>.