[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specific fixed width question...

From: John W. Eaton
Subject: Re: Specific fixed width question...
Date: Thu, 16 Sep 2010 05:50:16 -0400

On 16-Sep-2010, CdeMills wrote:

| A real single-liner with vector output:
| cellfun('str2num', regexp('WA 053 011 Clark County             45 ', '\d+',
| 'match')) 
| ans =
|    53   11   45

That works fine as long as the fields that are only alphabetic
characters above don't sometimes have numbers embedded in them.  If
you really have fixed field widths and arbitrary info in some of the
fields, a simple regexp like the one above will probably not be
reliable.  Is there a good way to write the above using a regexp that
will only match the data in columns 4-6, 8-10, and 37-39?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]