1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2020 - Samuel GOUGEON
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"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="ja" xml:id="find">
21 <refname>find</refname>
22 <refpurpose>論理値ベクトルまたは行列のtrue要素の添え字を見つける</refpurpose>
39 ブールまたは数値のベクトル、行列、または超行列. ゼロ以外の数値は%Tと見なされます.
47 <para>返される添え字の最大数を指定する整数.
48 デフォルト値は"全て"を意味する -1 です.
49 このオプションは,全ての添え字の探索を避け,処理効率を改善するために
58 row vector of linearized indices of %T or non-zero elements, or empty matrix [].
63 <term>i1, i2, ..</term>
66 row vectors of directional indices, or empty matrix []
75 <literal>x</literal> が論理値の場合,
78 <literal>ii=find(x)</literal> は<literal>x(i)</literal>が
79 "true"の添字<literal>i</literal>のベクトルを返します.
80 trueとなる要素がみつからない場合,空行列が返されます.
83 <literal>[i1,i2,..]=find(x)</literal> は,
84 <literal>x(i1(n),i2(n),..)</literal>が "true" の
85 添字<literal>i1</literal> (行の場合) および
86 <literal>i2</literal> (列の場合),..のベクトルを返します.
88 <literal>i1</literal>,<literal>i2</literal>, ...の空行列を返します.
91 <literal>x</literal> が標準行列またはハイパー行列の場合,
92 <literal>find(x)</literal>は<literal>find(x<>0)</literal>
96 <literal>find([])</literal> は <literal>[]</literal>を返します.
104 <programlisting role="example"><![CDATA[
105 A = [%F %T %T %F ; %T %F %F %T]
110 --> A = [%F %T %T %F ; %T %F %F %T]
126 <programlisting role="example"><![CDATA[
127 B = [0 -1 0 3 ; 0 -1 -0.4 0]
133 --> B = [0 -1 0 3 ; 0 -1 -0.4 0]
142 --> [i, j] = find(B);
151 With an input hypermatrix of numbers:
153 <programlisting role="example"><![CDATA[
154 E = grand(2,5,2,"uin",1,6)
158 --> E = grand(2,5,2,"uin",1,6)
172 With an input numerical or boolean sparse matrix:
174 <programlisting role="example"><![CDATA[
183 // With input boolean sparse
192 3. 4. 5. 7. 9. 13. 14. 15. 18.
198 --> // With input boolean sparse
201 ( 3, 6) sparse boolean matrix
219 With the result of a boolean element-wise condition on texts
221 <programlisting role="example"><![CDATA[
222 beers = ["Desperados", "Leffe", "Kronenbourg", "Heineken"];
223 find(beers == "Leffe")
224 find(beers == "1664")
227 --> find(beers == "Leffe")
231 --> find(beers == "1664")
236 Addressing selected elements:
238 <programlisting role="example"><![CDATA[
239 // a) Through their linearized indices:
240 H = [ 0 -2 -8 4 -5 -1
246 // b) Directly through the array of their boolean status:
251 --> // a) Through their linearized indices:
252 --> H = [ 0 -2 -8 4 -5 -1
256 --> L(find(L < 0)) = -10
258 0. -10. -10. 4. -10. -10.
259 -10. 2. -10. 5. 0. 1.
261 --> // b) Directly through the array of their boolean status:
265 0. -10. -10. 4. -10. -10.
266 -10. 2. -10. 5. 0. 1.
269 <refsection role="see also">
271 <simplelist type="inline">
273 <link linkend="vectorfind">vectorfind</link>
276 <link linkend="grep">grep</link>
279 <link linkend="findobj">findobj</link>
282 <link linkend="boolean">boolean</link>