help-octave
[Top][All Lists]
Advanced

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

Re: Specific fixed width question...


From: CdeMills
Subject: Re: Specific fixed width question...
Date: Thu, 16 Sep 2010 02:33:26 -0700 (PDT)


forkandwait wrote:
> 
>> 
>>  regexp('WA 053 011 Clark County             45 ', '\d+', 'match')
>> ans =
>> 
>> {
>>   [1,1] = 053
>>   [1,2] = 011
>>   [1,3] = 45
>> }
>> 
> 
> Well, sure, there could be more syntactical sugar like awk for dlmread,
> plus
> there is still the intermediate step of changing the above parsed data
> into a
> matrix.  Intuitive and a single line is always better than sort of
> intuitive and
> four lines.
> 
> 

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

   53   11   45

Regards

Pascal
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Specific-fixed-width-question-tp2539259p2541834.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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