MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to return the position of a multidimensional list ..


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




  • Prev by Date: Re: Extracting functions from Solve
  • Next by Date: MMA 3.0 buggy on NextStep/Intel?
  • Previous by thread: How to return the position of a multidimensional list ..
  • Next by thread: [Q] EEPack for MMa 3.0, antennae