How can I use Legacy Code Tool to create a Simulink S-function block with multiple output ports in Simulink 7.0 (R2007b)?
조회 수: 2 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2009년 9월 10일
댓글: Sainath Varikuti
2015년 6월 23일
I want to use Legacy Code Tool to create a Simulink S-function block with multiple output ports in Simulink 7.0 (R2007b).
채택된 답변
MathWorks Support Team
2018년 5월 11일
In order to create a S-function block with multiple output ports from existing C code using Legacy Code Tool, the specification has to be provided in the "OutputFcnSpec" field of the LEGACY_CODE structure. An example implementation is shown in the attached files.
The function "lct_simple_demo" uses the existing C-code "myfunc.c" to create a S-function block with multiple ports. This S-function block is used in the demo "lct_demo.mdl" model.
To run the function, type the following at the MATLAB command prompt:
lct_simple_demo
Multiple outputs from an existing C-code can also be obtained by using a "bus". An example implementation of the same is shown in the demo "Calling Legacy Functions with Structure Arguments Using Buses". To view this demo, type the following at the MATLAB command prompt:
showdemo sldemo_lct_bus_script
댓글 수: 1
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Block and Blockset Authoring에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!