<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      Le 28/12/2016 09:16, <a class="moz-txt-link-abbreviated" href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a> a écrit :<br>
    </div>
    <blockquote cite="mid:037f8fecbcad92365dcad6a1c041e492@free.fr"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div class="pre" style="margin: 0; padding: 0; font-family:
        monospace">Hi all<br>
        <br>
        I do not understand why the following code does not work when I
        try to<br>
        use vectorization (many trials)? <br>
        <br>
        What am I doing wrong ? <br>
        <br>
        Thanks <br>
        <br>
        Paul <br>
        ################################################################
        <br>
        <br>
        mode(0)<br>
        <br>
        A = [ 1 2 9 0 10 6 ; 5 3 8 8 0 9 ; 5 9 1 0 3 9]'<br>
        v = [2 9 6]'<br>
        <br>
        index = zeros(3,1);<br>
        for i = 1 : 3<br>
            index(i) = find(A(:,1) == v(i));<br>
        end<br>
        disp(index)<br>
        <br>
        i = [1 : 3]';<br>
        index2 = zeros(3,1); //pause<br>
        index2(i,1) = find(A(:,1) == v(i,1));<br>
      </div>
    </blockquote>
    <br>
    When with "==" you compare a matrix A to a scalar, the result is a
    matrix with the sizes of A, and find() works well (it just returns
    the indices of true components).<br>
    When with "==" you compare a matrix A to another one B having the
    same sizes, then "==" works element-wise: the result is a matrix
    with the sizes of A, and find() still works well.<br>
    When with "==" you compare a matrix A to another one B NOT having
    the same sizes, then "==" returns simply %F, and find(%F) returns []<br>
    <a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/comparison.html">https://help.scilab.org/docs/6.0.0/en_US/comparison.html</a><br>
    <br>
    What you try to do is achieved with members().<br>
    <br>
    Samuel<br>
    <br>
  </body>
</html>