Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: REGEXP extract data
Date: Fri, 18 Jan 2008 19:26:00 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 19
Message-ID: <fmqug8$a4s$1@canopus.cc.umanitoba.ca>
References: <fmqt09$mtb$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1200684360 10396 192.70.172.160 (18 Jan 2008 19:26:00 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 18 Jan 2008 19:26:00 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:446387



In article <fmqt09$mtb$1@fred.mathworks.com>, Pete sherer <tsh@abg.com> wrote:
>I have character data like:

>aa = {'BI234','EVB67','C4566','St Vermont','DD'};
>How can I use REGEXP to separate the character and the number?

>so 
>aa1 = {'BI','EVB','C','St Vermont','DD'};
>aa2 = {'234','67','4566','',''};;

Well, you could certainly do it with regexp, but if those
strings illustrate the complete range of variations, then why not
use  find(ismember(aa{i}, '0':'9'), 1)  to find the index
of the first digit in aa{i} ? If you need to run over the entire
aa cell, you can either loop or cellfun() with UniformOutput 0 .
Note: the output of the find() will be empty for strings without digits.
-- 
   "Any sufficiently advanced bug is indistinguishable from a feature."
   -- Rich Kulawiec