Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Help using textscan or sscanf
Replies: 21   Last Post: Jan 23, 2013 4:02 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kevin Ellis

Posts: 58
Registered: 11/29/10
Re: Help using textscan or sscanf
Posted: Jan 20, 2013 6:44 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"james bejon" wrote in message <kdh46g$p9$1@newscl01ah.mathworks.com>...
> % Apologies if this has already been solved elsewhere--haven't had time to read through the thread, but...
> S = {'154045001', '926665001', '615017', '1976936151', '801700', '4506702001'};
> regexprep(S, '^.*?([0-9]{1,9})$', '4421$1')


James,

Your solution is perfect for what I need to do with the dataset arrays I have. Using regexprep in this way is very innovative in my mind. I'm pretty impressed. However, I was hoping to get your help once more. To make things more complicated now, is there a way to use regexprep to take as input the following account number and return the following result?

S = '09837381019'

regexprep(S, No idea what to put here, '4412$1')

4412373810

Again, I need to pull out the digits '373810' from the account number and append '4412' to the beginning. I have never been able to use regexprep or regexpi to remove specific digits, but it seems like you may know how to do that. Any help would be much appreciated.

Kevin



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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.