From: harel on
Often, while incorporating an embedded matlab function to be called from different states on a state-flow chart, a "constant out of range" error is reported after trying to compile it. It alway work while in internal mode, though. I've bypassed the problem by duplicating that function, thus simply avoiding to call it from different states, but this causes the model to be cumbersome and difficult to debug. I feel that it have something to do with the definition of the inputs and outputs of the function (i.e. static, global, etc.), But I'm not familiar with the way to manage that properties.