<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381</link>
    <title>MATLAB Central Newsreader - How to match string  for cell array strmatch() in Matlab</title>
    <description>Feed for thread: How to match string  for cell array strmatch() in Matlab</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Wed, 03 Dec 2008 20:28:32 -0500</pubDate>
      <title>How to match string  for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#614868</link>
      <author>Xiaoxiao</author>
      <description>Hi:&lt;br&gt;
&lt;br&gt;
I have a string cell array like&lt;br&gt;
&lt;br&gt;
v={{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}&lt;br&gt;
&lt;br&gt;
v =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{1x1 cell}    {1x1 cell}    {1x1 cell}    {1x1 cell}&lt;br&gt;
&lt;br&gt;
and I would like to use strmatch() to located the cell array index in&lt;br&gt;
which the string contains 'a' for example. I used below command:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;idx = strmatch('a', v)&lt;br&gt;
??? Error using ==&amp;gt; cell.strmatch at 18&lt;br&gt;
Requires character array or cell array of strings as inputs.&lt;br&gt;
&lt;br&gt;
K&amp;gt;&amp;gt; idx = strmatch('a', v(:))&lt;br&gt;
??? Error using ==&amp;gt; cell.strmatch at 18&lt;br&gt;
Requires character array or cell array of strings as inputs.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;idx = strmatch('a', v{:})&lt;br&gt;
??? Error using ==&amp;gt; cell.strmatch&lt;br&gt;
Too many input arguments.&lt;br&gt;
&lt;br&gt;
I wrote v like above rather than v = {'aaa', 'bbb', 'cc', 'ddd'}&lt;br&gt;
directly is because I got something like the original v above format&lt;br&gt;
when I used textscan() function to read each line from a textfile and&lt;br&gt;
then I need to parse the textscan results using the strmatch but met&lt;br&gt;
same errors as I got above.&lt;br&gt;
&lt;br&gt;
Any help wil be appreciated.</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 21:00:21 -0500</pubDate>
      <title>Re: How to match string  for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#614874</link>
      <author>Stuart McGarrity</author>
      <description>Xiaoxiao &amp;lt;xiaoxiaoyang@live.com&amp;gt; wrote in message &amp;lt;e4c5e8e5-865e-44b8-b8a2-b2f19f8edb83@20g2000yqt.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have a string cell array like&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; v={{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; v =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;     {1x1 cell}    {1x1 cell}    {1x1 cell}    {1x1 cell}&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; and I would like to use strmatch() to located the cell array index in&lt;br&gt;
&amp;gt; which the string contains 'a' for example. I used below command:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  idx = strmatch('a', v)&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; K&amp;gt;&amp;gt; idx = strmatch('a', v(:))&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  idx = strmatch('a', v{:})&lt;br&gt;
&amp;gt; ??? Error using ==&amp;gt; cell.strmatch&lt;br&gt;
&amp;gt; Too many input arguments.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I wrote v like above rather than v = {'aaa', 'bbb', 'cc', 'ddd'}&lt;br&gt;
&amp;gt; directly is because I got something like the original v above format&lt;br&gt;
&amp;gt; when I used textscan() function to read each line from a textfile and&lt;br&gt;
&amp;gt; then I need to parse the textscan results using the strmatch but met&lt;br&gt;
&amp;gt; same errors as I got above.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any help wil be appreciated.&lt;br&gt;
&lt;br&gt;
You will probabaly need to use cellfun or a loop as you have the extra cell level. If you just want to know if there is an 'a' but don't care where in the string it is, you could use:&lt;br&gt;
&amp;gt;&amp;gt; cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1     0     0     0</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 21:17:11 -0500</pubDate>
      <title>Re: How to match string for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#614879</link>
      <author>Xiaoxiao</author>
      <description>On Dec 3, 4:00=A0pm, &quot;Stuart McGarrity&quot;&lt;br&gt;
&amp;lt;stuart.mcgarrity.nos...@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Xiaoxiao &amp;lt;xiaoxiaoy...@live.com&amp;gt; wrote in message &amp;lt;e4c5e8e5-865e-44b8-b8a=&lt;br&gt;
2-b2f19f8ed...@20g2000yqt.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have a string cell array like&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; v=3D{{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; v =3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0 =A0 {1x1 cell} =A0 =A0{1x1 cell} =A0 =A0{1x1 cell} =A0 =A0{1x1 cell=&lt;br&gt;
}&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; and I would like to use strmatch() to located the cell array index in&lt;br&gt;
&amp;gt; &amp;gt; which the string contains 'a' for example. I used below command:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0idx =3D strmatch('a', v)&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; K&amp;gt;&amp;gt; idx =3D strmatch('a', v(:))&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0idx =3D strmatch('a', v{:})&lt;br&gt;
&amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch&lt;br&gt;
&amp;gt; &amp;gt; Too many input arguments.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I wrote v like above rather than v =3D {'aaa', 'bbb', 'cc', 'ddd'}&lt;br&gt;
&amp;gt; &amp;gt; directly is because I got something like the original v above format&lt;br&gt;
&amp;gt; &amp;gt; when I used textscan() function to read each line from a textfile and&lt;br&gt;
&amp;gt; &amp;gt; then I need to parse the textscan results using the strmatch but met&lt;br&gt;
&amp;gt; &amp;gt; same errors as I got above.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Any help wil be appreciated.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You will probabaly need to use cellfun or a loop as you have the extra ce=&lt;br&gt;
ll level. If you just want to know if there is an 'a' but don't care where =&lt;br&gt;
in the string it is, you could use:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ans =3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 =A0 =A01 =A0 =A0 0 =A0 =A0 0 =A0 =A0 0- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
Thank you very much for the help, Stuart. It is very helpful. Here I&lt;br&gt;
have one more question. Can you tell me why you need to use x{1}&lt;br&gt;
instead of x directly in the strfind() function? Thanks again.</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 21:53:02 -0500</pubDate>
      <title>Re: How to match string for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#614889</link>
      <author>Stuart McGarrity</author>
      <description>Xiaoxiao &amp;lt;xiaoxiaoyang@live.com&amp;gt; wrote in message &amp;lt;bfe4a0fb-0fcd-4df2-bb9b-678743c2e104@j39g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Dec 3, 4:00=A0pm, &quot;Stuart McGarrity&quot;&lt;br&gt;
&amp;gt; &amp;lt;stuart.mcgarrity.nos...@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; Xiaoxiao &amp;lt;xiaoxiaoy...@live.com&amp;gt; wrote in message &amp;lt;e4c5e8e5-865e-44b8-b8a=&lt;br&gt;
&amp;gt; 2-b2f19f8ed...@20g2000yqt.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Hi:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I have a string cell array like&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; v=3D{{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; v =3D&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; =A0 =A0 {1x1 cell} =A0 =A0{1x1 cell} =A0 =A0{1x1 cell} =A0 =A0{1x1 cell=&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; and I would like to use strmatch() to located the cell array index in&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; which the string contains 'a' for example. I used below command:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; =A0idx =3D strmatch('a', v)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; K&amp;gt;&amp;gt; idx =3D strmatch('a', v(:))&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; =A0idx =3D strmatch('a', v{:})&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ??? Error using =3D=3D&amp;gt; cell.strmatch&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Too many input arguments.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; I wrote v like above rather than v =3D {'aaa', 'bbb', 'cc', 'ddd'}&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; directly is because I got something like the original v above format&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; when I used textscan() function to read each line from a textfile and&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; then I need to parse the textscan results using the strmatch but met&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; same errors as I got above.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Any help wil be appreciated.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; You will probabaly need to use cellfun or a loop as you have the extra ce=&lt;br&gt;
&amp;gt; ll level. If you just want to know if there is an 'a' but don't care where =&lt;br&gt;
&amp;gt; in the string it is, you could use:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt;&amp;gt; cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; ans =3D&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; =A0 =A0 =A01 =A0 =A0 0 =A0 =A0 0 =A0 =A0 0- Hide quoted text -&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you very much for the help, Stuart. It is very helpful. Here I&lt;br&gt;
&amp;gt; have one more question. Can you tell me why you need to use x{1}&lt;br&gt;
&amp;gt; instead of x directly in the strfind() function? Thanks again.&lt;br&gt;
&lt;br&gt;
In the statement: cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&lt;br&gt;
...cellfun takes each element of the cell array v and passes it to your anonymous function, in this case @(x) ~isempty(strfind(x{1},'a')).&lt;br&gt;
&lt;br&gt;
Now, as your cell array array is in fact an array of cells, in the anonyous function x is a cell. e.g.&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; x=v{1};&lt;br&gt;
&amp;gt;&amp;gt; whos&lt;br&gt;
&amp;nbsp;&amp;nbsp;Name      Size            Bytes  Class    Attributes                      &lt;br&gt;
&amp;nbsp;&amp;nbsp;v         1x4               502  cell               &lt;br&gt;
&amp;nbsp;&amp;nbsp;x         1x1                68  cell               &lt;br&gt;
&lt;br&gt;
You need to index into the cell 'x' (using {} braces) to reach the string.&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; c=x{1};&lt;br&gt;
&amp;gt;&amp;gt; whos&lt;br&gt;
&amp;nbsp;&amp;nbsp;Name      Size            Bytes  Class    Attributes&lt;br&gt;
&amp;nbsp;&amp;nbsp;c         1x4                 8  char               &lt;br&gt;
&amp;nbsp;&amp;nbsp;v         1x4               502  cell               &lt;br&gt;
&amp;nbsp;&amp;nbsp;x         1x1                68  cell    &lt;br&gt;
&lt;br&gt;
Stuart</description>
    </item>
    <item>
      <pubDate>Wed, 03 Dec 2008 22:17:17 -0500</pubDate>
      <title>Re: How to match string for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#614898</link>
      <author>Xiaoxiao</author>
      <description>On Dec 3, 4:53=A0pm, &quot;Stuart McGarrity&quot;&lt;br&gt;
&amp;lt;stuart.mcgarrity.nos...@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; Xiaoxiao &amp;lt;xiaoxiaoy...@live.com&amp;gt; wrote in message &amp;lt;bfe4a0fb-0fcd-4df2-bb9=&lt;br&gt;
b-678743c2e...@j39g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; On Dec 3, 4:00=3DA0pm, &quot;Stuart McGarrity&quot;&lt;br&gt;
&amp;gt; &amp;gt; &amp;lt;stuart.mcgarrity.nos...@mathworks.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; Xiaoxiao &amp;lt;xiaoxiaoy...@live.com&amp;gt; wrote in message &amp;lt;e4c5e8e5-865e-44b8=&lt;br&gt;
-b8a=3D&lt;br&gt;
&amp;gt; &amp;gt; 2-b2f19f8ed...@20g2000yqt.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Hi:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I have a string cell array like&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; v=3D3D{{'aaaa'}, {'bb'}, {'ccc'}, {'dd'}}&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; v =3D3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; =3DA0 =3DA0 {1x1 cell} =3DA0 =3DA0{1x1 cell} =3DA0 =3DA0{1x1 cell} =&lt;br&gt;
=3DA0 =3DA0{1x1 cell=3D&lt;br&gt;
&amp;gt; &amp;gt; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; and I would like to use strmatch() to located the cell array index =&lt;br&gt;
in&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; which the string contains 'a' for example. I used below command:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; =3DA0idx =3D3D strmatch('a', v)&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; ??? Error using =3D3D=3D3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; K&amp;gt;&amp;gt; idx =3D3D strmatch('a', v(:))&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; ??? Error using =3D3D=3D3D&amp;gt; cell.strmatch at 18&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Requires character array or cell array of strings as inputs.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; =3DA0idx =3D3D strmatch('a', v{:})&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; ??? Error using =3D3D=3D3D&amp;gt; cell.strmatch&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Too many input arguments.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; I wrote v like above rather than v =3D3D {'aaa', 'bbb', 'cc', 'ddd'=&lt;br&gt;
}&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; directly is because I got something like the original v above forma=&lt;br&gt;
t&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; when I used textscan() function to read each line from a textfile a=&lt;br&gt;
nd&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; then I need to parse the textscan results using the strmatch but me=&lt;br&gt;
t&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; same errors as I got above.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt; Any help wil be appreciated.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; You will probabaly need to use cellfun or a loop as you have the extr=&lt;br&gt;
a ce=3D&lt;br&gt;
&amp;gt; &amp;gt; ll level. If you just want to know if there is an 'a' but don't care wh=&lt;br&gt;
ere =3D&lt;br&gt;
&amp;gt; &amp;gt; in the string it is, you could use:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; &amp;gt;&amp;gt; cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; ans =3D3D&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; =3DA0 =3DA0 =3DA01 =3DA0 =3DA0 0 =3DA0 =3DA0 0 =3DA0 =3DA0 0- Hide qu=&lt;br&gt;
oted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &amp;gt; - Show quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Thank you very much for the help, Stuart. It is very helpful. Here I&lt;br&gt;
&amp;gt; &amp;gt; have one more question. Can you tell me why you need to use x{1}&lt;br&gt;
&amp;gt; &amp;gt; instead of x directly in the strfind() function? Thanks again.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; In the statement: cellfun(@(x) ~isempty(strfind(x{1},'a')),v)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ...cellfun takes each element of the cell array v and passes it to your a=&lt;br&gt;
nonymous function, in this case @(x) ~isempty(strfind(x{1},'a')).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, as your cell array array is in fact an array of cells, in the anonyo=&lt;br&gt;
us function x is a cell. e.g.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; x=3Dv{1};&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; whos&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 Name =A0 =A0 =A0Size =A0 =A0 =A0 =A0 =A0 =A0Bytes =A0Class =A0 =A0Att=&lt;br&gt;
ributes =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&lt;br&gt;
&amp;gt; =A0 v =A0 =A0 =A0 =A0 1x4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 502 =A0cell =A0 =A0=&lt;br&gt;
&amp;nbsp;=A0 =A0 =A0 =A0 =A0&lt;br&gt;
&amp;gt; =A0 x =A0 =A0 =A0 =A0 1x1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A068 =A0cell =A0 =&lt;br&gt;
=A0 =A0 =A0 =A0 =A0 =A0&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You need to index into the cell 'x' (using {} braces) to reach the string=&lt;br&gt;
.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; c=3Dx{1};&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; whos&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; =A0 Name =A0 =A0 =A0Size =A0 =A0 =A0 =A0 =A0 =A0Bytes =A0Class =A0 =A0Att=&lt;br&gt;
ributes&lt;br&gt;
&amp;gt; =A0 c =A0 =A0 =A0 =A0 1x4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 8 =A0char =A0 =&lt;br&gt;
=A0 =A0 =A0 =A0 =A0 =A0&lt;br&gt;
&amp;gt; =A0 v =A0 =A0 =A0 =A0 1x4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 502 =A0cell =A0 =A0=&lt;br&gt;
&amp;nbsp;=A0 =A0 =A0 =A0 =A0&lt;br&gt;
&amp;gt; =A0 x =A0 =A0 =A0 =A0 1x1 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A068 =A0cell =A0 =&lt;br&gt;
=A0&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Stuart- Hide quoted text -&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - Show quoted text -&lt;br&gt;
&lt;br&gt;
Thank you so much for your time, help and patience on this question,&lt;br&gt;
Stuart.</description>
    </item>
    <item>
      <pubDate>Thu, 04 Dec 2008 17:22:01 -0500</pubDate>
      <title>Re: How to match string for cell array strmatch() in Matlab</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240381#615086</link>
      <author>Ryan Ollos</author>
      <description>Xiaoxiao &amp;lt;xiaoxiaoyang@live.com&amp;gt; wrote in message &amp;lt;bfe4a0fb-0fcd-4df2-bb9b-678743c2e104@j39g2000yqn.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; Thank you very much for the help, Stuart. It is very helpful. Here I&lt;br&gt;
&amp;gt; have one more question. Can you tell me why you need to use x{1}&lt;br&gt;
&amp;gt; instead of x directly in the strfind() function? Thanks again.&lt;br&gt;
&lt;br&gt;
You might find it less confusing if you first convert your &quot;cell containing an array of cells&quot; into an &quot;array of cells&quot;:&lt;br&gt;
&lt;br&gt;
u = [v{:}];&lt;br&gt;
&lt;br&gt;
Then you can call Stuart's function like this:&lt;br&gt;
&lt;br&gt;
cellfun(@(x) ~isempty( strfind(x, 'a') ), u)</description>
    </item>
  </channel>
</rss>

