Daniel@0: function idx = findString(str, cellArray,ignoreCase) Daniel@0: % Returns a boolean matrix the same size as cellArray with true everywhere Daniel@0: % the corresponding cell holds the specified string, str. Daniel@0: Daniel@0: if nargin < 3, ignoreCase = false; end Daniel@0: if ignoreCase, fn = @(c)strcmpi(c,str); else fn = @(c)strcmp(c,str); end Daniel@0: idx = cellfun(fn,cellArray); Daniel@0: end