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

1 vue (au cours des 30 derniers jours)
Is there an example of using Simulink buses with "coder.ceval" to handle structured data?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 11 Déc 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:

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by