Chandler,
You can loop over one array and remove from it any elements that don't occur in the other one.
{a, } = GetMapLayers(, "Point")
{b, } = GetMapLayers(, "Active")
for i = a.length to 1 step -1 do
if ArrayPosition(b, {a[i]}, ) = 0 then
{b, } = GetMapLayers(, "Active")
for i = a.length to 1 step -1 do
if ArrayPosition(b, {a[i]}, ) = 0 then
// a[i] is not in b so remove it
a = ExcludeArrayElements(a, i, 1)
end
a = ExcludeArrayElements(a, i, 1)
end
ShowArray(a)
-Kjartan
From: Chandler Coleman [mailto:[EMAIL PROTECTED]
To: [email protected]
Sent: Wed, 31 May 2006 18:48:26 -0400
Subject: [Maptitude] taking elements out of an array
I have used two functions:
GetMapLayers(, "Point")
GetMapLayers(, "Active")
I now have an array with 43 elements and another with 6. I want to now
compare the two and include only the layers that are in both. However,
I have tried the ExcludeArrayElements() and the InsertArrayElements()
with zero success.
What functions do I use to get a new array with what both these arrays
have in common?
Thanks
Chandler
------------------------ Yahoo! Groups Sponsor --------------------~-->
Everything you need is one click away. Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/C5grlB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Maptitude/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
SPONSORED LINKS
| Geographic information systems | Geography game | Geography |
YAHOO! GROUPS LINKS
- Visit your group "Maptitude" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
