function idx=indexOf(v,s) % Find a string in a vector and return index % Arguments: (vector, string) error(nargchk(2, 2, nargin)); idx = -1; % examine each item in vector for i=1:length(v) % compare strings if (strcmp(v(i), s) == 1) idx = i; end end