Re: Lists and rules
- To: mathgroup at smc.vnet.net
- Subject: [mg66524] Re: Lists and rules
- From: "Szabolcs Horvat" <szhorvat at gmail.com>
- Date: Fri, 19 May 2006 03:39:11 -0400 (EDT)
- References: <e4bj1m$1b9$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You could use Position[ ]. Here, T[[1]] is A.
In[1]:=
A=Table[Random[Integer,{1,3}],{20}]
Out[1]=
{3,2,3,3,3,1,1,2,3,1,1,2,2,2,1,1,2,3,1,2}
In[2]:=
S1=Flatten[Position[A,1]]
Out[2]=
{6,7,10,11,15,16,19}
But be careful, you may not use underscores in symbol names (like S_1)!
Use S1 instead.