Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

How to extract a pattern


Hi,
I have the following problem.  I have to extract from a file data 
structure which is specified by a label (e.g. "A"), a set of points 
("lbl") and the corresponding weights ("mod")  (example is attached).  
Data is berried within a lot of garbage. The only invariant structure in 
all files is e.g.:

{"(iter)","Filter", "A"}, {"lbl", 5, 2., 20., 20.,20., 2.}, {"mod", 5, 
0., 0.6, 0., 0.7, 0.}

where "ilter", "lbl" and "mod" are always present but  "{iter}" differs 
from file to file.  The first element after "lbl" and "mod" is the same 
- the number of point for this filter.

How can I extract only these list elements which contain "Filter" and 
"lbl" and "mod"?
Thanks in advance,
Ted


{{"MEN(00)=", "total", "sa=", 3.717*10^-6, "[um]"}, {"Field", "[m/s]:", 
2.615, 80., 83.,51., 10., 6., 5., 66.,1.175}, {"Filtered", "[m/s]:", 
1.2, 4.2, 2., 46., 520., 990., 800., 143., 862.}, {},
{"(iter)", "Filter", "A"}, {"lbl", 5, 2., 20., 20., 20., 2.}, {"mod", 5, 
0., 0.6, 0., 0.7, 0.},
{"(iter)", "Filter", "B"}, {"lbl", 1, 14., 14., 600.,660., 50., 20., 
10., 15., 16., 1.}, {"mod", 10, 0., 0.14, 1., 0.97, 0.97, 0.9, 0.89, 
0.7, 0.1, 0.},
{"(iter)", "Filter", "C"}, {"lbl", 5, 1., 1., 1., 1., 1.}, {"mod", 5, 
0., 0.1, 1., 0.6, 0.6},
{"(iter)", "Filter", "D"}, {"lbl", 7, 1., 1., 1., 1., 1., 1., 1.}, 
{"mod", 7, 0., 10., 0.1, 10., 0., 0.8, 0.},
{"(iter)", "Filter", "E"}, {"lbl", 5, 9.,9., 9., 9., 9.}, {"mod", 5, 0., 
0.2, 7., 0.9, 0.},
{"(iter)", "Filter", "F"}, {"lbl", 2, 3.,4.}, {"mod", 2, 1., 1.},
{"(iter)", "Filter", "G"}, {"lbl", 2, 3., 3.}, {"mod", 2, 1., 1.},
{"(iter)", "Filter", "H"}, {"lbl", 2, 1.,3.}, {"mod", 2, 1., 1.}, {"#"}}


  • Prev by Date: Re: Is there ToNumber?
  • Next by Date: Washington DC Area Mathematica SIG
  • Previous by thread: Re: Is there ToNumber?
  • Next by thread: Re: Is there ToNumber?