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 日間)
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
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlock and Blockset Authoring についてさらに検索

タグ

製品


リリース

R2007b

Community Treasure Hunt

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

Start Hunting!

Translated by