Multiple s-function blocks produce different outputs.

Hi,
I am building a simulink model which contains a number of S-function blocks (let's say two for simplicity). These blocks all have the same C mex-file, but different parameter values. The problem is now that only one of these two blocks produces a correct output. Even if the parameters and inputs of both blocks are the same, the outputs don't match. (I have stored the parameters in the real work vector.)
Does someone have an idea on what could cause this problem?
Pieter

댓글 수: 1

Babak
Babak 2012년 11월 12일
Do the S-functions have tlc files too? Did you create a mask for the S functions? if so different masks or same?

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

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 11월 12일

0 개 추천

Are you using static variables in the C code? If so, you need to replace them with work vectors. It might also be a good idea to debug your S-function to find out exactly what is going wrong.

댓글 수: 2

Pieter
Pieter 2012년 11월 13일
I don't think that I am using static variables in the C code. I am not very familiar with C code, but if I put 'auto' before the declaration of my variables, the results are the same as before.
Pieter: I don't know what else to suggest other than ask you to try debugging your code to narrow down the issue to specific snippets of code. :(

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

카테고리

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

제품

태그

질문:

2012년 11월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by