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

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

 Risposta accettata

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:

Più risposte (0)

Categorie

Scopri di più su Simulink Coder in Centro assistenza e File Exchange

Prodotti

Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by