Path: news.mathworks.com!newsfeed-00.mathworks.com!irazu.switch.ch!switch.ch!news.belwue.de!feed.news.tiscali.de!blackbush.cw.net!cw.net!news.rh-tec.net!itgate.net!news-out.tin.it!news-in.tin.it!news3.tin.it.POSTED!not-for-mail
From: gigio <gigio@tin.it>
Newsgroups: comp.soft-sys.matlab
Subject: easy string manipolation
Message-ID: <lpc3b1p3gdrofngj4bnpurj1sj95mqp263@4ax.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 29
Date: Thu, 16 Jun 2005 17:20:34 GMT
NNTP-Posting-Host: 82.53.24.205
X-Complaints-To: "Please send abuse reports to abuse@tin.it and technical notifications to newsmaster@tin.it"
X-Trace: news3.tin.it 1118942434 82.53.24.205 (Thu, 16 Jun 2005 19:20:34 MET DST)
NNTP-Posting-Date: Thu, 16 Jun 2005 19:20:34 MET DST
Organization: TIN
Xref: news.mathworks.com comp.soft-sys.matlab:285198



Sorry for the easy question...

I have some strings like these
dummy='a, b'
dummy='a ,b'
dummy='a b'
dummy='a,b'

first and second terms are separated by space OR/AND comma
I wish to separate first adn second term of the string 

This is my solution
----
[first,second]=strtok(dummy,' ,')
idx=find (second==',' |isspace(second) );
second(idx)=[];

first
second
----
It works, but it is not easy to generalize for string with 'n' terms
Any hint ??

Thank you very much!!