differences between "C Function" and "S-Function (Builder)"

hi, what's the differences between "C Function" and "S-Function (Builder)"?
is there any suggestion about when and in what case to use which method, for implementing integrated c/c++ code simuliation?
in my understanding, these two methods could be replaced by each other in most application cases, only except as said in help document:
"The C Function block supports initializing persistent data and calling external functions from the block dialog. The C Function block supports only initializing and terminating persistent data; the block does not support updating the data during simulation. To model a dynamic system with continuous states, use an S-Function block. "
but the above explanation is a little obscure, is there an example/demo to show how "C Function" or "S-Function (Builder)" is more suitable for a kind of use-case than the other?
thanks

댓글 수: 1

for more reference, my concerned use-cases are basically the "discrete" and "fixed-step" applications.

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

답변 (1개)

Mark McBroom
Mark McBroom 2022년 12월 29일

0 개 추천

The 2 blocks have similar use cases. The recommended approach is the C Function block or C Caller Block. These two blocks are newere and designed to be easier to use.

댓글 수: 1

"The C Function block supports initializing persistent data and calling external functions from the block dialog. The C Function block supports only initializing and terminating persistent data; the block does not support updating the data during simulation. To model a dynamic system with continuous states, use an S-Function block. " So where this difference is actually spotted?

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

카테고리

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

제품

릴리스

R2021a

질문:

2022년 12월 8일

댓글:

2024년 9월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by