<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi,<br>
<br>
Ok, now I remember, it is there :<br>
<br>
<a
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 cite="mid:728126.96813.qm@web130201.mail.mud.yahoo.com"
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 class="moz-txt-link-rfc2396E" href="mailto: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 class="moz-txt-link-rfc2396E" href="mailto:Samuel.Gougeon@univ-lemans.fr"><Samuel.Gougeon@univ-lemans.fr></a><br>
Subject: Re: [scilab-Users] Matlab ismember<br>
To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
Date: Sunday, January 16, 2011, 6:21 PM<br>
<br>
<div class="plainMail"><br>
Hello,<br>
<br>
dragomir nedeltchev <<a moz-do-not-send="true"
ymailto="mailto:dnedelchev65@yahoo.com"
href="/mc/compose?to=dnedelchev65@yahoo.com">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 moz-do-not-send="true"
href="http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=threadindex&month=200911&threadid=epdldcdicfagcdofccbc"
target="_blank">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 moz-do-not-send="true"
href="http://lists.scilab.org/cgi-bin/ezmlm-browse?list=users&cmd=search"
target="_blank">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="moz-signature" cols="72">--
Michaël Baudin
Ingénieur de développement
<a class="moz-txt-link-abbreviated" href="mailto:michael.baudin@scilab.org">michael.baudin@scilab.org</a>
-------------------------
Consortium Scilab - Digiteo
Domaine de Voluceau - Rocquencourt
B.P. 105 - 78153 Le Chesnay Cedex
Tel. : 01 39 63 56 87 - Fax : 01 39 63 55 94
</pre>
</body>
</html>