function posns = stringmatch(keys, strs)
% STRINGMATCH Find possible matches for strings.
% i = stringmatch(str, strs) where str is a string and strs is a cell array of strings
% works just like the built-in command i = strmatch(str, strs, 'exact'). We assume there is
% exactly one occurence of str in strs.
% If str is a cellarray, the j'th element of i will be the matching position of str{j}.
%
% This function used to be called 'assoc'

if ~iscell(keys), keys = {keys}; end
nkeys = length(keys);
posns = zeros(1, nkeys);
for i=1:nkeys
  pos = strmatch(keys{i}, strs, 'exact');
  assert(length(pos)==1);
  posns(i) = pos;
end

