From: Etienne on
Hi All

I am having a very weird problem, and I am not sure how to track the root cause down. I have a mex file in Fortran, where I am tracking the derivatives of a system, either defined by equations, or the same equations in Simulink. When I run the matlab file "func.m" that conatins the matlab equations of the derivatives, it runs fine, but when I use the following form, that calls a simulink model

der=feval('ab',0,U,PAR(1:3),'derivs');

The derivatives are incorrect. I have done all sorts of tests, and the error definately occurs when "func.m" is called from the mex-file. I therefore think that some memory is being overwritten somewhere, but I am not sure how I can firstly track this, or avoid this.

Any help would be appreciated.

Etienne