Is there an example of using Simulink buses with "coder.ceval" to handle structured data?

1 Ansicht (letzte 30 Tage)

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 11 Dez. 2019
Attached is an example, named "ceval_struct.zip", of using Simulink buses when passing data to a C function using "coder.ceval".
To run the example:
  1. Download and extract "ceval_struct.zip" into its own directory
  2. Execute:
>> example
Please note that the bus, "TestBus", is defined in MATLAB in "setup.m", which imports the structure defined in "test_func.h", in the structure named "TestBus".
The expected output of the model is shown below:
Inputs:
a: 1.5
b: [0.1, 0.2, 0.3, 0.4, 0.5]
Outputs:
y[0] = 0.8
y[1] = 1.5
a: -1.5
b: [1, 0.8, 0.6, 0.4, 0.2]
You will see a similar output in the Simulink model, "test_model.slx", when it is opened and simulated.
You may see more regarding "coder.ceval", data type marshaling, and working with Simulink buses and MATLAB function blocks in the following documentation links:

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by