필터 지우기
필터 지우기

Simulink Diagram to C code - function

조회 수: 2 (최근 30일)
Tim
Tim 2012년 6월 12일
Using R2011b.
I have created a simple Simulink diagram with three inputs & one output. When I generate C code for the model, the output is either an external reference or scoped to the file.
How do I get the output to be the return value?
ex. real_T output foobar(real_T inputA, real_T inputB, real_T inputC)
I've tried countless combinations via the Configuration Parameters dialogs.

채택된 답변

TAB
TAB 2012년 6월 13일
Hope you are using Embedded coder with simulink coder (Real time workshop).
To change the model function prototype goto to Interface tab --
  • Clear the checkbox Generate reusable code and click on Configure Functions button.
  • Set the Function specification --> Model specific C prototype.
  • Enter function name --> foobar and click on Get Default Configuration button. A function argument table will appear.
  • For all the ports select category --> Value.
Note that, if you has multiple outputs from the mode l, as C language fundamental only one output can be taken as function return argument.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by