Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

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.


  • Prev by Date: Re: NonlinearFit problem
  • Next by Date: Re: Extract any diagonal from a square matrix...
  • Previous by thread: Re: Lists and rules
  • Next by thread: Re: ViewPoint selector