This is what my own function file looks like:
function h = fcn(t,p)%#codegen
h=XSteam('h_pt',p,t);
And this is de part where the error is referring to in the XSteam mfile:
function h4L_p = h4L_p(p)if (p > 0.000611657 & p < 22.06395)==1 Ts = T4_p(p); if p < 16.529 h4L_p = h1_pT(p, Ts); else %Iterate to find the the backward solution of p3sat_h
Low_Bound = 1670.858218; High_Bound = 2087.23500164864; ps=-1000; while abs(p - ps) > 0.00001 hs = (Low_Bound + High_Bound) / 2; ps = p3sat_h(hs); if ps > p High_Bound = hs; else Low_Bound = hs; end end h4L_p = hs; ERROR OCCURS ON THIS LINE(line 2480 in XSteam) if true % code
end endelse h4L_p = -99999;end if true % code end
The complete XSteam mfile can be found at:
I already tried to place "persistent hs;" after function, but that didn't solve the problem.
Best Answer