Re: Mathematica 6.0 easier for me ... (small review)
- To: mathgroup at smc.vnet.net
- Subject: [mg76562] Re: Mathematica 6.0 easier for me ... (small review)
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Thu, 24 May 2007 05:57:00 -0400 (EDT)
On 5/23/07 at 4:59 AM, Paul at desinc.com wrote:
>If I have lis={{1,10},{2,10},...{9,10},{11,20},{12,20}...{19,20}
>How do I use functional and/or rule to determine where the second
>number (lis[[i,2]]) jumped from 10 to 20 to 30 and save the pair.
Split can be used to find the jump. For example,
In[11]:= lis = {{1, 10}, {2, 10}, {9, 10}, {11, 20}, {12, 20}, {19,
20}};
Split[lis, #1[[2]] == #2[[2]] &][[All, {1, -1}]]
Out[12]= {{{1, 10}, {9, 10}}, {{11, 20}, {19, 20}}}
Here, I've retained the first and last pair of each group with
the same last element
--
To reply via email subtract one hundred and four