1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2011 - Bernard DUJARDIN
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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="find">
18 <refname>find</refname>
19 <refpurpose>trouve les indices des éléments vrais d'un vecteur ou d'une matrice de booléens</refpurpose>
22 <title>Séquence d'appel</title>
23 <synopsis>[ii]=find(x [,nmax])
24 [i1,i2,..]=find(x [,nmax])
28 <title>Paramètres</title>
33 <para>peut être un vecteur booléen, une matrice booléenne, une hypermatrice booléenne, une matrice ou une hypermatrice "standard".</para>
39 <para>un entier donnant le nombre maximal d'indices à retourner. La valeur par défaut est -1 qui signifie "tous". Cette option peut être utilisée dans un but d'efficacité en évitant la recherche de tous les indices.</para>
43 <term>ii, i1, i2, .. </term>
45 <para>vecteurs d'entiers des indices ou matrices vides</para>
51 <title>Description</title>
53 Si <literal>x</literal> est une matrice booléenne,
56 <literal>ii=find(x)</literal> retourne le vecteur des indices <literal>i</literal> pour lesquels <literal>x(i)</literal> est "vrai". Si aucun élément vrai
57 n'est trouvé find retourne une matrice vide.
60 <literal>[i1,i2,..]=find(x)</literal> retourne le vecteur des indices <literal>i1</literal> (pour les lignes) et <literal>i2</literal> (pour les colonnes),..
61 tel que <literal>x(i1(n),i2(n),..)</literal> est "vrai". Si aucun élément vrai n'est
62 trouvé find retourne des matrices vides dans <literal>i1</literal>,
63 <literal>i2</literal>, ...
66 Si <literal>x</literal> est une matrice standard ou une hypermatrice <literal>find(x)</literal> est interprété comme
67 <literal>find(x<>0).</literal>
70 <literal>find([])</literal> retourne <literal>[].</literal>
74 <title>Exemples</title>
75 <programlisting role="example"><![CDATA[
76 beers=["Desperados", "Leffe", "Kronenbourg", "Heineken"];
77 find(beers=="Leffe") // OK
78 find(beers=="1664") // KO
79 find(beers=="Foster") // KO
80 beers=[beers, "Foster"]
81 find(beers=="Foster") // OK
89 w=find(B<0.4,2) //retourne au plus deux valeurs
91 H=rand(4,3,5); //une hypermatrice
97 <refsection role="see also">
98 <title>Voir aussi</title>
99 <simplelist type="inline">
101 <link linkend="boolean">boolean</link>
104 <link linkend="extraction">extraction</link>
107 <link linkend="insertion">insertion</link>
110 <link linkend="vectorfind">recherche de vecteur</link>