You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mapKEGGID.m
    path of file: ./repos/yeast-GEM/code/.deprecated/modelCuration
    
    the code of the file until where you have to start completion: % This script maps reaction IDs and metabolite IDs of different databases
% to find new rxnKEGGID(s) and metKEGGID(s)
%
% Inputs: model
%
% getRxnsFromMetaCyc and getMetsFromMetaCyc are functions from RAVEN
%
% reactions.tsv and compounds.tsv from modelSEED database is downloaded directly from GitHub repository ModelSEEDDatabase
% link: github.com/ModelSEED/ModelSEEDDatabase
%

%load model
cd ..
model = loadYeastModel;

%% rxnKEGGID
%map rxnMetaNetXID to rxnKEGGID via function mapIDsViaMNXref
cd missingFields
xref_rxnKEGG = mapIDsViaMN
    
function mapIDsViaMNXref
cd missingFields
xref_rxnKEGG = mapIDsViaMNXref('rxns',model.rxnMetaNetXID,'MetaNetX','KEGG');
xref_rxnKEGG(:,2) = model.rxns; %match rxnKEGGID with model.rxns
xref_rxnKEGG(:,3) = model.rxnMetaNetXID; %match rxnKEGGID with model.rxnMetaNetXID
xref_rxnKEGG(:,4) = model.rxnKEGGID; %match rxnKEGGID with model.rxnKEGGID

%only retain mapped rxnKEGGID if model.rxnKEGGID is empty
empties = find(cellfun('isempty',xref_rxnKEGG(:,1)));
xref_rxnKEGG(empties,:) = [];
empties = find(~cellfun('isempty',xref_rxnKEGG(:,4)));
xref_rxnKEGG(empties,:) = [];

%add rxnKEGGID into model
[~,idx] = ismember(xref_rxnKEGG(:,2),model.rxns);
idx = idx(idx~=0);

for i = 1:length(idx)
    model.rxnKEGGID(idx(i)) = xref_rxnKEGG(i,1);
end