Re: Import numerical data and split by pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg94457] Re: Import numerical data and split by pattern
- From: Raffy <raffy at mac.com>
- Date: Sun, 14 Dec 2008 07:35:46 -0500 (EST)
- References: <ghtjl9$rfu$1@smc.vnet.net>
parse[sPath_String] := Module[{vLines = ReadList[sPath, String], iBag = 0, bOpen = True}, Last[Reap[Do[Which[ StringLength[s] >= 2 && StringTake[s, 2] === "##", bOpen = True; iBag++, StringLength[s] >= 1 && StringTake[s, 1] === "#", bOpen = False, True, If[bOpen, Sow[ToExpression[StringSplit[s]], iBag]] ], {s, vLines}]]]];