The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: one-liner to parse an alpha-numeric string
Replies: 5   Last Post: Nov 22, 2005 12:41 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Duane Bozarth

Posts: 298
Registered: 1/25/05
Re: one-liner to parse an alpha-numeric string
Posted: Nov 22, 2005 12:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Jos wrote:
> Using regular expressions and <strread> might do:
> s = 'P245/45ZR18' ;
> [SW,AR,RD] = strread(regexprep(s,'\D',' '),'%f %f %f') ;
> should work for any string with three (positive) numbers with any
> number (>0) of non-digits in between ...

Nice...I don't have a new enough version of Matlab to have either
function so had use a more traditional approach.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.