Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!20g2000yqt.googlegroups.com!not-for-mail
From: Xiaoxiao <xiaoxiaoyang@live.com>
Newsgroups: comp.soft-sys.matlab
Subject: How to match string  for cell array strmatch() in Matlab
Date: Wed, 3 Dec 2008 12:28:32 -0800 (PST)
Organization: http://groups.google.com
Lines: 33
Message-ID: <e4c5e8e5-865e-44b8-b8a2-b2f19f8edb83@20g2000yqt.googlegroups.com>
NNTP-Posting-Host: 199.120.152.100
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1228336112 7922 127.0.0.1 (3 Dec 2008 20:28:32 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 3 Dec 2008 20:28:32 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: 20g2000yqt.googlegroups.com; posting-host=199.120.152.100; 
	posting-account=4XpXrwoAAADAXwqFgZzGOn1SmnxMe8pK
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; 
	InfoPath.1; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
Bytes: 2105
Xref: news.mathworks.com comp.soft-sys.matlab:504798


Hi:

I have a string cell array like

v={{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}

v =

    {1x1 cell}    {1x1 cell}    {1x1 cell}    {1x1 cell}

and I would like to use strmatch() to located the cell array index in
which the string contains 'a' for example. I used below command:

 idx = strmatch('a', v)
??? Error using ==> cell.strmatch at 18
Requires character array or cell array of strings as inputs.

K>> idx = strmatch('a', v(:))
??? Error using ==> cell.strmatch at 18
Requires character array or cell array of strings as inputs.

 idx = strmatch('a', v{:})
??? Error using ==> cell.strmatch
Too many input arguments.

I wrote v like above rather than v = {'aaa', 'bbb', 'cc', 'ddd'}
directly is because I got something like the original v above format
when I used textscan() function to read each line from a textfile and
then I need to parse the textscan results using the strmatch but met
same errors as I got above.

Any help wil be appreciated.