Why do I get a build error when generating a code for model containing stateflow in MATLAB 2011b "error calling s generated S function" ?

2 views (last 30 days)
Why do I get a build error when generating a code for model containing stateflow "error calling s generated S function" ?
Model simulates properly, when build system to generate code is selected the following error is got in MATLAB 2011b. The model has a stateflow and I'm taking a guess its because of this.
Error recieved is : Error calling generated Sfunction, model_sfun. Undefined function 'model_sfun' for input arguments of type 'double'

Answers (1)

Gerhard Feichtinger
Gerhard Feichtinger on 8 Jul 2015
I just had the same error in 2015a, and it seems to be because I was setting the Simulink CodeGenFolder and CacheFolder parameters to nonstandard values. I'm not sure if there's a similar StateFlow value to set, but commenting out these lines from my setup file fixed the issue. So maybe it's something that you set up for Simulink that Stateflow is expecting in a different location?
% Simulink.fileGenControl('set', 'CacheFolder', [userpath '/_code_dummy_'], 'createDir', true)
% Simulink.fileGenControl('set', 'CodeGenFolder', [userpath '/_code_dummy_'], 'createDir', true)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!