stringmatch.m

来自「麻省理工学院的人工智能工具箱,很珍贵,希望对大家有用!」· M 代码 · 共 18 行

M
18
字号
function posns = stringmatch(keys, strs)% STRINGMATCH Find possible matches for strings.% pos = stringmatch(key, strs) where key is a string and strs is a cell array of strings% works just like the built-in command pos = strmatch(key, strs, 'exact'). We assume there is% exactly one occurence of key in strs.%% posns = stringmatch(keys, strs), where keys is a cell array of strings, matches each element of keys.if ~iscell(keys), keys = {keys}; endnkeys = length(keys);posns = zeros(1, nkeys);for i=1:nkeys  pos = strmatch(keys{i}, strs, 'exact');  assert(length(pos)==1);  posns(i) = pos;end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?