Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3284 > unrolled thread

parsing a strig

Started byTed Sariyski <tsariysk@craft-tech.com>
First post2011-06-24 11:53 +0000
Last post2011-06-24 11:53 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  parsing a strig Ted Sariyski <tsariysk@craft-tech.com> - 2011-06-24 11:53 +0000

#3284 — parsing a strig

FromTed Sariyski <tsariysk@craft-tech.com>
Date2011-06-24 11:53 +0000
Subjectparsing a strig
Message-ID<iu1ts0$9m4$1@smc.vnet.net>
Hi,
I import a text file with Import[filename,"Table"]. The file has a 
header followed by data. The header contains predefined keywords like 
TITLE, ZONE, VARIABLES, etc.  A VARIABLES line, shown below, is a list 
of 'varname,varunits' pairs, which I need to extract as pairs.

{{VARIABLES,=,'um','I_p,(W/sr/um)','I_a,(W/sr/um)','I_ae,(W/sr/um)','m','I_p,(W/sr/m)','I_a,(W/sr/m)','I_ae,(W/sr/m)'}}

I tried StringSplit[varList,"'"] but got
Out[]:  {{um,,,I_p},{(W/sr/um),,,I_a},{(W/sr/um),,,I_ae},...}}, which is 
wrong.

I tried StringSplit[Drop[vars, 2], "'"] and got
Out[]: {{I_a (W/sr/um)},{I_ae (W/sr/um)},...}}, which miss the first 
variable 'um'.

How can I parse this?
Thanks in advance,
--Ted

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web