Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: importing fixed width data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97626] Re: importing fixed width data
  • From: Vince <blueschi at gmail.com>
  • Date: Tue, 17 Mar 2009 05:00:14 -0500 (EST)
  • References: <gpg1lt$cps$1@smc.vnet.net>

On Mar 14, 6:42 am, swiftset <swift... at gmail.com> wrote:
> Hi, I'm trying to import data from a file where the fields are stored
> in a fixed width format. The Import["file", "Table"] command is the
> closest I can get to what I'd like, but then the data is divided using
> whitespace, so I get a lot of extraneous fields, and no way to tell
> whether what Mathematica imported as two fields is actually just one
> that contained a whitespace.
>
> Any ideas on how to proceed?

Some variation of:

ToExpression@StringTake[Import["file", "List"], <fieldSpecs>]

Vince Virgilio


  • Prev by Date: Re: setting discrete values for a function -- newbie
  • Next by Date: Re: setting discrete values for a function -- newbie
  • Previous by thread: Re: importing fixed width data
  • Next by thread: Two Notebooks Open at the Same Time