MATLAB: Developing inline s-function driver block

driver blockembedded cinline s-function

Hi,
I'm developing inline s-function driver block. I have created the .c .tlc and .mex32 files, and I also created the necessary library. And I put all this files in Matlab path. But when I want to generate C files with RTW appears this error:
Error using ==> rtwgen –> Error in S-function myModel/model_DI': S-Function 'model_DI' does not exist.
If I put all the files in the WORK folder I don't have this problem but after I can't pass information from Model to generate files through function MdlRTW because then I have this error:
Error using ==> rtwgen Error in mdlRTW of S-function myModel/model_DI'. This function wrote 0 run-time parameters where as it has registered 4 run-time parameters.
Thanks in advance

Best Answer

Did you add the S-function and corresponding TLC to a directory under the $matlabroot/toolbox folder by any chance? If yes, you may need to run "rehash toolboxcache" for MATLAB to recognize new folders under this directory structure. (Although it is recommended that you place your files outside of the MATLAB installation root, because it could get wiped during upgrades or at un-install) Once you have done that, run "which model_DI" to make sure that MATLAB finds the MEX-file.
Regarding the error about parameters - could you include some code snippets about how you're registering your run-time parameters and how you use them in your mdlRTW function?