MathGroup Archive 2006

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

Search the Archive

Re: Repeated sequence

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64049] Re: Repeated sequence
  • From: "dkr" <dkrjeg at adelphia.net>
  • Date: Sun, 29 Jan 2006 05:57:26 -0500 (EST)
  • References: <dr80a3$ph3$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Borut,

Here is a different pattern matching approach:
In[28]:=
StringCases[ToString@list,

RegularExpression["10,\\s([^,]+),\\s20,\\s([^,]+)"]\[RuleDelayed]{"$1",
        "$2"}]//ToExpression
Out[28]=
{{12.1426,18.2932},{10.3823,15.2443},{10.3823,15.2443},{8.62206,

12.1954},{8.62206,12.1954},{12.1426,12.1954},{12.1426,12.1954},{15.6631,

12.1954},{15.6631,12.1954},{13.9028,15.2443},{13.9028,15.2443},{12.1426,

18.2932},{3.7764,18.0222},{6.87499,17.7511},{3.42781,16.6671},{6.10034,

16.0477},{4.70598,15.5831},{5.51936,15.0798},{4.47358,14.5377},{5.44189,

13.686},{4.62851,12.7181},{5.44189,11.3631},{4.35739,10.0467},{4.82217,
    9.0014},{4.20246,7.33662},{5.79048,6.83332}}

If you wish to preserve the nesting of your original list you can:

In[29]:=
StringCases[ToString[#],
        RegularExpression[

"10,\\s([^,]+),\\s20,\\s([^,]+)"]\[RuleDelayed]{"$1","$2"}]&/@
    list//ToExpression
Out[29]=
{{{12.1426,18.2932},{10.3823,15.2443}},{{10.3823,15.2443},{8.62206,
      12.1954}},{{8.62206,12.1954},{12.1426,12.1954}},{{12.1426,
      12.1954},{15.6631,12.1954}},{{15.6631,12.1954},{13.9028,
      15.2443}},{{13.9028,15.2443},{12.1426,18.2932}},{{3.7764,

18.0222},{6.87499,17.7511},{3.42781,16.6671},{6.10034,16.0477},{4.70598,

15.5831},{5.51936,15.0798},{4.47358,14.5377},{5.44189,13.686},{4.62851,

12.7181},{5.44189,11.3631},{4.35739,10.0467},{4.82217,9.0014},{4.20246,
      7.33662},{5.79048,6.83332}}}


dkr


  • Prev by Date: Re: Re: How to get range of InterpolatingFunction ?
  • Next by Date: Re: Annoying Maximize behaviour
  • Previous by thread: Re: Repeated sequence
  • Next by thread: deleting cells in mathematica