www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@functionlookup/lookup.m

    function values = lookup(obj, realkeys)
%LOOKUP Returns the function handles assigned for given key.
%
%   FUNCTIONHANDLES = LOOKUP( FUNCTIONLOOKUP, KEYS )
%
%   Where KEYS is either a string or a cell array of strings.

%   Copyright 2005 The MathWorks, Inc.
%        .

if ~iscell(realkeys)
    NOT_VECTORISED = true;
    realkeys = {realkeys};
else
    NOT_VECTORISED = false;
end

% possibly convert to a string version
keys = obj.pKeyToString( realkeys );

numKeys = numel(keys);
values = cell(numKeys, 1);

% Find these keys in our list of encountered keys
[found, index] = ismember(lower(keys), lower(obj.KeyCache));
% See pAppendEncounteredKeys for the meaning of ValueIndex
values(found) = obj.Values(obj.ValueIndex(index(found)));
% Which ones did we not find
if ~all(found)    
    [values(~found), newKeys, newValues] = pKeyNotFound( obj, keys(~found), realkeys(~found) );
    % Update the manager with the new information
    obj.pAppendEncounteredKeys(newKeys, newValues);
end

if NOT_VECTORISED
    values = values{1};
end