Figured it out myself. For anyone looking at something similar, I used the below method. Feel free to offer any insight or improvements still.
function [S,m] = sum_and_min(u)
%#codegen
persistent old_min;
persistent sum;
persistent interim;
if(isempty(interim) || isnan(u))
interim = 0;
else
interim = u;
end
if isempty(sum)
sum = 0;
old_min = 0;
end
% for each incoming sample u:
sum = sum + interim;
old_min = min([old_min,sum]);
S = sum;
m = old_min;
end