function [tnext,rxnnum] = find_next_reaction(rxn) numrxns = length(rxn); tnext = inf; for i = 1:numrxns checktime = rxn{i}.time; if checktime < tnext tnext = checktime; rxnnum = i; end end