"S-Function does not exist" but is clearly in the Matlab path!

Hello,
I am working with a huge simulink model that uses a lot of custom library blocks and S-functions.
But 3 of them dont work, the error is just: "Error in S-function 'modelname/subsystem/block': S-Function 'sfun_name' does not exist"
But I have a folder in my model library with the files name.cpp, name.h, sfun_name.cpp and also the simulink model of the library block.
This folder is definetely added to the path, I checked with the path command
It used to work but now simulink says these S-functions do not exist, but they do.
I tried to replace the blocks from the library but it did not help.
Does anyone have an idea about this? Or what else would I need to provide? (I am not allowed to upload any files from the model)
Thank you!

댓글 수: 2

Also add the mex file of the sfun to the path
check if running matlab as an administrator (right click on the icon and run as an administrator) solves the problem. It worked for me

댓글을 달려면 로그인하십시오.

 채택된 답변

Mark McBroom
Mark McBroom 2021년 2월 4일

1 개 추천

Do you have a file named sfun_name.mexw64? Simulink needs the s-function to be compiled into a mexw64( which is a specialzed DLL). If you don't have a .mexw64, then you will need to create one by compiling your C code into a mexw64 file with the "mex" command. https://www.mathworks.com/help/matlab/ref/mex.html?searchHighlight=mex&s_tid=srchtitle
mex sfun_name.cpp

댓글 수: 1

We actually found a mex32 file... (The model was created in a older version on a different computer)
But since it is now a 64 bit system this might be the issue!
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Naming Conventions에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2021년 2월 3일

댓글:

2024년 12월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by