Simulink SFunction Interface Error: due to insufficient storage
1 view (last 30 days)
Very simple function block, with matrices input and constants total less than 80MB. Sample time 1, Simulation Duration 2. Code runs as a snap in Matlab. Moved into a system model failed in compilation (Xp 32-bit, 4GB) with error:
MATLAB Function Interface Error: Error calling generated SFunction, test_sfun, due to insufficient storage. This is most likely due to large static arrays in the generated code. Disabling debugging may help.
Same model compile and run perfectly on: Win7 x64 Matlab x64 8GB system
Can anyone please comment on this, the model has a keyword: simple.
Or maybe there is an SFuntion design criteria I should have read.
Fred Smith on 18 Jul 2012
Have you tried turning off debugging in the MATLAB Function block? That usually has a dramatic effect and allows many more examples to work.
Kaustubha Govind on 16 Jul 2012
Are you using the (Embedded) MATLAB Function block to bring your MATLAB code into Simulink? The MATLAB Function block generates C-code from the MATLAB code before executing it (and runs it via a C-MEX S-function), so it is slightly different from running the code directly in MATLAB. Perhaps 80MB is too large for the program stack on 32-bit Windows. You could try converting your large data into global variables and see if that helps. Please see Using Global Data with the MATLAB Function Block for more information.