How to add MEX files to a custom library

I want to create a custom library to use with my friends in Simulink. What I do respectively is here:
  1. Create several S-Functions and then create MEX files with "mex" command
  2. Create a library (.mdl) and place my S-Functions in it
  3. Cut&paste the library file(mylibrary.mdl) in the directory $matlabroot/toolbox/mylibrary
  4. Copy MEX files (of S-Functions) in the directory $matlabroot/toolbox/mylibrary
  5. Create slblocks.m (to display my library in Library Browser) file in the directory $matlabroot/toolbox/mylibrary
I can see my library and S-Functions in the Library borwser and also I can drag and drop S-Functions blocks into any model. But when I try to generate code of a model I get this error:
"Error in S-function '{MODEL_NAME}/{S_FUNCTION_NAME}': S-Function '{S_FUNCTION_NAME}' does not exist"
So, where do I need to place MEX files to generate code of models with using my custom library?
Regards, Vahit.

Risposte (1)

I'm assuming that $matlabroot/toolbox/mylibrary has already been added to your MATLAB path since you say that your library shows up in the Simulink library browser. Could you run this command and try running Ctrl+D (update) on your model?
>> rehash toolboxcache

Categorie

Scopri di più su Simulink Coder in Centro assistenza e File Exchange

Prodotti

Richiesto:

il 2 Apr 2012

Community Treasure Hunt

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

Start Hunting!

Translated by