[Scilab-Dev] Intersection of two vectors

Arvid Rosén arvid at softube.com
Mon Oct 29 09:13:05 CET 2012


Maybe like this:

[dummy, index] = find(kron(a, ones(length(b),1)) - kron(b', ones(a)) == 0)

Don't know if it is fast.

Cheers,
Arvid

28 okt 2012 kl. 19:25 skrev Orbeman <ludo.wag at laposte.net>:

> Hello,
> 
> Does anyone have an idea to modify the native intersect function in Scilab.
> I would like to have all positions (not only for unique element) of a vector
> that is in an other vector. I prefer avoid any loop because it's huge
> matrix.
> 
> For example, a=[1 2 3 2 3 4 5 2 6 3] and b=[2 3] give c=[2 3 4 5 8 10] as
> result.
> 
> Thanks.
> 
> Sorry, for my bad english. I hope its understable.
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/Intersection-of-two-vectors-tp4025092.html
> Sent from the Scilab developers - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> dev mailing list
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev

--
Arvid Rosén

Softube AB
S:t Larsgatan 10c
SE-582 24 Linköping
Sweden
Mobile: (+46) 73 25 123 47
Office: (+46) 13 21 16 23
Fax: (+46) 13 10 00 23
Mail: arvid at softube.com
URL: www.softube.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20121029/7b3816ee/attachment.htm>


More information about the dev mailing list