I have a simulink matlab function block where I am trying to use ode23 with an events function, but I get the following error when compiling:
All inputs must be constant.
Function 'npcFullProp_debug.m' (#274.284.325), line 8, column 14:
"odeset('RelTol',1e-6,'Events',@npcEvents)"
@npcEvents is defined as a nested function so it can access 'env_par', a structure from the parent function (npcFullProp_debug).
(Note: Matlab Function Block > guidanceLong.m > npcFullProp_debug.m > ode23)
I also tried to make 'env_par' global, but simulink just gets stuck at t = 0.00 s until I stop the simulation. Still haven't figured out why.
Is there a solution that avoids the use of global variables? (why/why not?) I have been running ode23 in small 10sec arcs and checking the events manually, but this curbs the efficacy of a variable step solver.