Re: How to return the position of a multidimensional list ..
- To: mathgroup at smc.vnet.net
- Subject: [mg7070] Re: [mg7040] How to return the position of a multidimensional list ..
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Sat, 3 May 1997 22:04:59 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
2 May 1997
cmchung at se.cuhk.edu.hk (Chung Cheong Ming)
[mg7040] How to return the position of a multidimensional list ..
>eg. OuterList = {sublist1, sublist2, ...}
>
>I want to find where a sublist situates in the OuterList if I know
>the first 2 elements of this sublist.
Joseph:
OuterList = {{1,2,3},{2,1,3}};
Position[OuterList,{2,1,___}]
{{2}}
If the sublists contain more complex elements you may need to limit
the search:
Position[OuterList,{2,1,___},
{1}, (*level*),
Heads->False (*not inside heads*)
]
{{2}}
Allan Hayes
hay at haystack.demon.co.uk
http://haystack.demon.co.uk