call mexfile from sfunction

Hi how can I call a mex-file in an S-Function Builder in simulink? I find a mex-file in the internet and don't know about its source code. this mex-file hase several inputs argumant and several outputs. I wanna to use it in my sfunction, but donn't know how can I do it.

 채택된 답변

Friedrich
Friedrich 2013년 4월 18일

0 개 추천

Hi,
at least a mexCallMATLAB from the S-function should work. Or also runtime dynamic linking. See my post here:

댓글 수: 5

omid jab
omid jab 2013년 4월 19일
thanx
Kaustubha Govind
Kaustubha Govind 2013년 4월 19일
Or just write a MATLAB S-function, and call your MEX-file like you would any other MATLAB function.
omid jab
omid jab 2013년 4월 21일
편집: omid jab 2013년 4월 21일
dear Kaustubha, I wanna write a C++ cod using "S-Function Builder" in simulink. I'm an amateur user, and thought can't use MATLAB function in "S-Function builder". Can I?
Kaustubha Govind
Kaustubha Govind 2013년 4월 22일
Omid: No, if you absolutely need a C-MEX S-function that is auto-generated using S-function Builder, then please follow Friedrich's solution. However, if there is no other C code that you need to call and you are okay with manually implementing a MATLAB S-function, you may follow my solution.
omid jab
omid jab 2013년 4월 23일
I understand, tanks for your help.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기

질문:

2013년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by