필터 지우기
필터 지우기

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

조회 수: 16 (최근 30일)
Brian Tremaine
Brian Tremaine 2021년 10월 20일
댓글: Brian Tremaine 2021년 10월 20일
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