C function calls and multiple calls from simulink

10 次查看(过去 30 天)
I am trying to call multiple instances of the same c-library however only the first c caller block (alphabetically) executes properly the second issues an error (from the c library).
In example 1 only the first entity is found but if I rename the call function (example 2) only the second entity is found. I think this is a Simulink runtime issue where the function calls are clashing and only the first one (alphabetically) runs properly. Not sure how to resolve so that more than one entity can be read in as only the first function call executes properly.
This seems to happen regardless of the actual call issued to the C library my suspicion is that its something to do with Simulinks run time and having multiple calls to the same c dll library.

回答(1 个)

Jonas
Jonas 2023-5-3
I do not deeply understand the issue, but I would like to propose the following. Create a Simulink Function block in your model and put your C-caller inside it. Use Inport and Outport argument blocks inside it to connect to the C caller block. Now replace the C-caller blocks you had in your Enabled Subsystems 'GetData' with Function Calller blocks to the Simulink Function. This way you are calling the Simulink Function block multiple times from different places, but you only have one C-caller block in your model.

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by