wolffd@0: function out = strcellfind(strdb, str, findAll) wolffd@0: % out = strcellfind(strdb, str) wolffd@0: % wolffd@0: % finds a string within an cell array of strings wolffd@0: % only outputs the first occurence, unless wolffd@0: % findAll is set to true wolffd@0: % wolffd@0: % strcellfind is NOT CASE sensitive wolffd@0: wolffd@0: if nargin < 3 wolffd@0: findAll = 0; wolffd@0: end wolffd@0: wolffd@0: out = []; wolffd@0: for i = 1:length(strdb) wolffd@0: if strcmpi( lower(char(strdb{i})), lower(char(str))) == 1; wolffd@0: if ~findAll wolffd@0: out = i; wolffd@0: return; wolffd@0: else wolffd@0: out(end+1) = i; wolffd@0: end wolffd@0: end wolffd@0: end wolffd@0: % --- wolffd@0: % NOTE: Bad backwards compability wolffd@0: % --- wolffd@0: % if isempty(out) wolffd@0: % out = -1; wolffd@0: % end