MathGroup Archive 2007

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

Search the Archive

Re: Selecting Sub-lists After Split


My suggestion:

In[4]:=
list={1,2,-3,-7,4,-8,9,12,-3};
newlist={Select[list,#>0 &],Select[list,#<0 &]}

Out[5]=
{{1,2,4,9,12},{-3,-7,-8,-3}}

Now can access the positive sublist and negative sublist using newlist[[1,i]] for the positive and newlist[[2,i]] for the negatives.


  • Prev by Date: Re: Selecting Sub-lists After Split
  • Next by Date: Re: Selecting Sub-lists After Split
  • Previous by thread: Re: Selecting Sub-lists After Split
  • Next by thread: Re: Selecting Sub-lists After Split