Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*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 1996

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

Search the Archive

Re: Re: Re: help! to input data...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4463] Re: [mg4394] Re: [mg4228] Re: help! to input data...
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Mon, 29 Jul 1996 02:37:19 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

welter at .ti.com (Jason Welter)
[mg4394] Re: [mg4228] Re: help! to input data...

Asks
>>>>>>>>>>>>>>>>>>>>>>>>.
John[John Fultz], do you know of a way to read this into MMA:

    Intradie---> [ACON]
      # TestName[ACT245P ]  [    PMC1] [    PMC2] [    PMC3] [     
PMC4] [    PMC5]
    ----------------------  ---------- ---------- ----------  
---------- ----------
       1 [CONTI_M1       ]  & 0.00000  & 1.00000  & 1.00000  &  
1.00000  & 2.00000

    Intradie---> [ACHNB]
      # TestName[ACT245P ]  [    PMC1] [    PMC2] [    PMC3] [     
PMC4] [    PMC5]
    ----------------------  ---------- ---------- ----------  
---------- ----------
       2 [CA_GOI_GOE_NM  ]   -19.5000   -19.3000   -19.6000    
-20.0000   -19.7000
       3 [CA_GOI_GOE_PM  ]    18.0000    17.8000    18.0000     
18.4000    18.2000
       4 [CH_1.00_NM_TR  ]    121.853    115.612    188.382     
168.093    273.507
       5 [CH_1.00_NM_TH  ]    125.392    162.555    164.442     
244.348    251.892
       6 [CH_1.00_PM_TR  ]    3.44601    3.30223    3.10842     
3.45061    4.58194
       7 [CH_1.00_PM_TH  ]    2.25403    2.03261    2.07853     
2.33058    3.10277

    Intradie---> [ACON]
      # TestName[ACT245P ]  [    PMC1] [    PMC2] [    PMC3] [     
PMC4] [    PMC5]
    ----------------------  ---------- ---------- ----------  
---------- ----------
       1 [CONTI_M1       ]  & 0.00000  & 1.00000  & 1.00000  &  
1.00000  & 2.00000

    Intradie---> [ACHNB]
      # TestName[ACT245P ]  [    PMC1] [    PMC2] [    PMC3] [     
PMC4] [    PMC5]
    ----------------------  ---------- ---------- ----------  
---------- ----------
       2 [CA_GOI_GOE_NM  ]   -19.5000   -19.3000   -19.6000    
-20.0000   -19.7000
       3 [CA_GOI_GOE_PM  ]    18.0000    17.8000    18.0000     
18.4000    18.2000
       4 [CH_1.00_NM_TR  ]    121.853    115.612    188.382     
168.093    273.507
       5 [CH_1.00_NM_TH  ]    125.392    162.555    164.442     
244.348    251.892
       6 [CH_1.00_PM_TR  ]    3.44601    3.30223    3.10842     
3.45061    4.58194
       7 [CH_1.00_PM_TH  ]    2.25403    2.03261    2.07853     
2.33058    3.10277


etc.

I have about a dozen files each hundreds of K large and am having  
to load it into Excel, parse & sort & prep for mathematica.  I need  
the numbers to be recognized as numbers by MMA, not characters.   
Ideally the data would look like:

    {{1,{1,0.00000,1.00000,1.00000,1.00000,2.00000},
        {2,-19.500,-19.300,-19.600,-20.000,-19.700},
        {3,18.0000,17.8000,18.0000,18.4000,18.2000},
        {4,121.853,115.612,188.382,168.093,273.507},
        {5,125.392,162.555,164.442,244.348,251.892},
        {6,3.44601,3.30223,3.10842,3.45061,4.58194},
        {7,2.25403,2.03261,2.07853,2.33058,3.10277}},
     {2,{1,0.00000,1.00000,1.00000,1.00000,2.00000},
        {2,-19.500,-19.300,-19.600,-20.000,-19.700},
        {3,18.0000,17.8000,18.0000,18.4000,18.2000},
        {4,121.853,115.612,188.382,168.093,273.507},
        {5,125.392,162.555,164.442,244.348,251.892},
        {6,3.44601,3.30223,3.10842,3.45061,4.58194},
        {7,2.25403,2.03261,2.07853,2.33058,3.10277}}}
>>>>>>>>>>>>>>>>>>>>>>.

Jason,
Here is a first attempt.

getdata[file_String]:=
   Module[{temp, ind, starts, ends, takes,n},
      temp = ReadList[file,Word,RecordLists->True];
      temp = Map[ToExpression,temp,{2}];
      temp = DeleteCases[DeleteCases[temp, $Failed|#1,{2}],{},2];
      starts = Position[data2, {1,__}]//Flatten;
      ends = Append[Rest[pos]-1, Length[data2]];
      takes = Transpose[{starts, ends}];
      n=1; Prepend[Take[temp, #],n++]&/@takes
]


I called your file fileHelp.


getdata["fileHelp"]//Timing

{0.25 Second,
{
  {1,	{1, 0., 1., 1., 1., 2.},
 	{2, -19.5, -19.3, -19.6, -20., -19.7},
    	{3, 18., 17.8, 18., 18.4, 18.2},
 	{4, 121.853, 115.612, 188.382, 168.093, 273.507},
 	{5, 125.392, 162.555, 164.442, 244.348, 251.892},
 	{6, 3.44601, 3.30223, 3.10842, 3.45061, 4.58194},
 	{7, 2.25403, 2.03261, 2.07853, 2.33058, 3.10277},
  },

  {2, 	{1, 0., 1., 1., 1., 2.},
  	{2, -19.5, -19.3, -19.6, -20., -19.7},
 	{3, 18., 17.8, 18., 18.4, 18.2},
 	{4, 121.853, 115.612, 188.382, 168.093, 273.507},
 	{5, 125.392, 162.555, 164.442, 244.348, 251.892},
 	{6, 3.44601, 3.30223, 3.10842, 3.45061, 4.58194},
 	{7, 2.25403, 2.03261, 2.07853, 2.33058, 3.10277}}
   }
}

Allan Hayes
hay at haystack.demon.co.uk





==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Help with ParametricPlot3D in color
  • Next by Date: 2d fit problem
  • Previous by thread: Re: Re: help! to input data...
  • Next by thread: Associated Legendre Function Problem in mma?