<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Thank you very much<br><br>--- On <b>Mon, 1/17/11, Michaël Baudin <i><michael.baudin@scilab.org></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Michaël Baudin <michael.baudin@scilab.org><br>Subject: Re: [scilab-Users] Matlab ismember<br>To: users@lists.scilab.org<br>Cc: "dragomir nedeltchev" <dnedelchev65@yahoo.com><br>Date: Monday, January 17, 2011, 5:30 PM<br><br><div id="yiv2122215135">
Oups, this is the good one :<br>
<br>
<a rel="nofollow" target="_blank" href="http://bugzilla.scilab.org/show_bug.cgi?id=8792">http://bugzilla.scilab.org/show_bug.cgi?id=8792</a><br>
<br>
Michaël<br>
<br>
Le 17/01/2011 16:26, Michaël Baudin a écrit :
<blockquote type="cite">
See the discussion at :<br>
<br>
<a rel="nofollow" target="_blank" href="http://bugzilla.scilab.org/process_bug.cgi">http://bugzilla.scilab.org/process_bug.cgi</a><br>
<br>
Best regards,<br>
<br>
Michaël Baudin<br>
<br>
Le 17/01/2011 16:10, Michaël Baudin a écrit :
<blockquote type="cite">
Hi,<br>
<br>
Ok, now I remember, it is there :<br>
<br>
<a rel="nofollow" target="_blank" href="http://forge.scilab.org/index.php/p/number/source/tree/HEAD/macros/number_ismember.sci">http://forge.scilab.org/index.php/p/number/source/tree/HEAD/macros/number_ismember.sci</a><br>
<br>
Unfortunately, I have not released this function in the binary
release yet.<br>
Here is a simplified version:<br>
<br>
function tf = number_ismember ( a , s )<br>
// Array elements that are members of set.<br>
//<br>
// Calling Sequence<br>
// tf = number_ismember ( a , s )<br>
//<br>
// Parameters<br>
// a : a ma-by-na matrix<br>
// s : a 1-by-ns matrix<br>
// tf : a ma-by-na matrix of booleans, tf(i,j) is %t if
there is an entry in s matching a(i,j).<br>
//<br>
// Description<br>
// Search in a the entries which are in s.<br>
// <br>
// Uses vectorized statements, based on the Kronecker
product. <br>
// The intermediate memory required is ma*na*ns.<br>
// <br>
// Examples<br>
// a = (1:5)'<br>
// s = [0 2 4 6 8 10 12 14 16 18 20]<br>
// tf = number_ismember ( a , s )<br>
// expected = [%f %t %f %t %f]'<br>
//<br>
// // An example with a matrix<br>
// a = [<br>
// 7 35 14 86 76 <br>
// 15 51 24 96 49 <br>
// 35 40 46 35 93 <br>
// 85 34 74 82 22<br>
// ];<br>
// s = [51 74 22 15 86] <br>
// tf = number_ismember(a, s)<br>
//<br>
// Authors<br>
// Copyright (C) 2010 - DIGITEO - Michael Baudin<br>
<br>
//<br>
// Check size<br>
// a can have any shape<br>
if ( s==[] ) then<br>
tf=(ones(a)==zeros(a))<br>
return<br>
end<br>
//<br>
// Check content<br>
// Nothing to do.<br>
//<br>
// Proceed...<br>
if ( a==[] ) then<br>
tf=[]<br>
return<br>
end<br>
//<br>
// Convert a into a column vector<br>
ma = size(a,"r")<br>
na = size(a,"c")<br>
a=a(:)<br>
//<br>
ns = size(s,"c")<br>
sp = s .*. ones(na*ma,1)<br>
ap = a .*. ones(1,ns)<br>
tf = or(ap==sp,"c")<br>
//<br>
// Convert tf into the same shape as a<br>
tf=matrix(tf,ma,na)<br>
endfunction<br>
<br>
This is an example:<br>
<br>
--> a = [<br>
--> 7 35 14 86 76 <br>
--> 15 51 24 96 49 <br>
--> 35 40 46 35 93 <br>
--> 85 34 74 82 22<br>
--> ];<br>
<br>
--> s = [51 74 22 15 86] <br>
s =<br>
<br>
51. 74. 22. 15. 86. <br>
<br>
--> tf = number_ismember(a, s)<br>
tf =<br>
<br>
F F F T F <br>
T T F F F <br>
F F F F F <br>
F F T F T <br>
<br>
Best regards,<br>
<br>
Michaël<br>
<br>
Le 16/01/2011 19:56, dragomir nedeltchev a écrit :
<blockquote type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font: inherit;" valign="top">thank you very
much<br>
<br>
--- On <b>Sun, 1/16/11, Samuel Gougeon <i><a rel="nofollow" class="yiv2122215135moz-txt-link-rfc2396E" ymailto="mailto:Samuel.Gougeon@univ-lemans.fr" target="_blank" href="/mc/compose?to=Samuel.Gougeon@univ-lemans.fr"><Samuel.Gougeon@univ-lemans.fr></a></i></b>
wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>
From: Samuel Gougeon <a rel="nofollow" class="yiv2122215135moz-txt-link-rfc2396E" ymailto="mailto:Samuel.Gougeon@univ-lemans.fr" target="_blank" href="/mc/compose?to=Samuel.Gougeon@univ-lemans.fr"><Samuel.Gougeon@univ-lemans.fr></a><br>
Subject: Re: [scilab-Users] Matlab ismember<br>
To: <a rel="nofollow" class="yiv2122215135moz-txt-link-abbreviated" ymailto="mailto:users@lists.scilab.org" target="_blank" href="/mc/compose?to=users@lists.scilab.org">users@lists.scilab.org</a><br>
Date: Sunday, January 16, 2011, 6:21 PM<br>
<br>
<div class="yiv2122215135plainMail"><br>
Hello,<br>
<br>
dragomir nedeltchev <<a rel="nofollow">dnedelchev65@yahoo.com</a>>
a écrit :<br>
<br>
> Hi, Can you help me replicate MATLAB's
ismember in SciLab? Thanks. Drago<br>
<br>
You may read the followinf thread:<br>
<a rel="nofollow" target="_blank" href="http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=threadindex&month=200911&threadid=epdldcdicfagcdofccbc">http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=threadindex&month=200911&threadid=epdldcdicfagcdofccbc</a><br>
<br>
When you have well defined keywords as here, you
should use them to search<br>
through the archives:<br>
<a rel="nofollow" target="_blank" href="http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=search">http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=search</a><br>
<br>
Regards<br>
Samuel<br>
<br>
<br>
</div>
</blockquote>
</td>
</tr>
</tbody>
</table>
<br>
</blockquote>
<br>
<br>
<pre class="yiv2122215135moz-signature">-- <br>Michaël Baudin<br>Ingénieur de développement<br><a rel="nofollow" class="yiv2122215135moz-txt-link-abbreviated" ymailto="mailto:michael.baudin@scilab.org" target="_blank" href="/mc/compose?to=michael.baudin@scilab.org">michael.baudin@scilab.org</a><br>-------------------------<br>Consortium Scilab - Digiteo<br>Domaine de Voluceau - Rocquencourt<br>B.P. 105 - 78153 Le Chesnay Cedex<br>Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94<br><br></pre>
</blockquote>
<br>
<br>
<pre class="yiv2122215135moz-signature">-- <br>Michaël Baudin<br>Ingénieur de développement<br><a rel="nofollow" class="yiv2122215135moz-txt-link-abbreviated" ymailto="mailto:michael.baudin@scilab.org" target="_blank" href="/mc/compose?to=michael.baudin@scilab.org">michael.baudin@scilab.org</a><br>-------------------------<br>Consortium Scilab - Digiteo<br>Domaine de Voluceau - Rocquencourt<br>B.P. 105 - 78153 Le Chesnay Cedex<br>Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94<br><br></pre>
</blockquote>
<br>
<br>
<pre class="yiv2122215135moz-signature">-- <br>Michaël Baudin<br>Ingénieur de développement<br><a rel="nofollow" class="yiv2122215135moz-txt-link-abbreviated" ymailto="mailto:michael.baudin@scilab.org" target="_blank" href="/mc/compose?to=michael.baudin@scilab.org">michael.baudin@scilab.org</a><br>-------------------------<br>Consortium Scilab - Digiteo<br>Domaine de Voluceau - Rocquencourt<br>B.P. 105 - 78153 Le Chesnay Cedex<br>Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94<br><br></pre>
</div></blockquote></td></tr></table><br>