Can't get Simulink model to recognize a Level-2 S-Function using c file

15 vues (au cours des 30 derniers jours)
Brian Tremaine
Brian Tremaine le 20 Oct 2021
Commenté : Brian Tremaine le 20 Oct 2021
Hi
I am using Matlab R2021a. I have a simple model in which I am using a Level-2 S-function and providing the name of a compiled C file. The C file name is phase_det.c and the name I put in the C file is #define S_FUNCTION_NAME phase_det
In the Simulink model (test.slx), I use a Level-2 S-Function I entered the name phase_det
This is similar to the Matlab example dsfunc.c. Which I have been successfully able to compile using mex dsfunc, then runnning okay.
Similarly, I was able to compile using mex phase_det.c.
When I run the Simulink model test.slx I get the error " Level-2 MATLAB S-function 'phase_det' does not exist"
I'v been working on this for hours and know it must be something really silly that I missed. Its almost like the phase_det.mexw64 file is not in my running directory, but it is.
I included the zipped files.
Thank-you very much for helping,
Brian
  1 commentaire
Brian Tremaine
Brian Tremaine le 20 Oct 2021
I am answering my own question. I think the S-Function block I was using was not a CMEX S-Function. I copied a C-code S-Function block from another woring program and edited the block to name it 'phase_det'. Doing this it did work.
The block I orignally used was labeled a 'Level 2 S-Function'. In the Simulink model once the block label is changed, such as calling it 'My Block' instead of 'Level 2 S-Function', it seems that there is now way to no what kind of block it is.
Am I missing something here?
Thanks

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by