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

16 次查看(过去 30 天)
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 个评论
Brian Tremaine
Brian Tremaine 2021-10-20
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

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by