<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Thanks for your help.</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Well I wanted to get the position of each scalar, as the loop does; I'll be content to use a loop</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span>Thanks for your time.</span></div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"><span>Paul</span></div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Le 2016-12-28 14:43, Samuel Gougeon a écrit :
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Le 28/12/2016 09:16, <a href="mailto:paul.carrico@free.fr">paul.carrico@free.fr</a> a écrit :<br /> <br />
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">Hi all<br /> <br /> I do not understand why the following code does not work when I try<br /> 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));</blockquote>
<br /> Actually, what you want and try to do is unclear. Even members() could<br /> be not appropriate.<br /> You can easily get an error even with your unvectorized version, as<br /> soon as one of the v components will appears several times in A(:,1)<br /> <br /> SG<br /> _______________________________________________<br /> users mailing list<br /> <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br /> <a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank" rel="noreferrer">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
</div>
</body></html>