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

1 visualización (últimos 30 días)

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 11 de Dic. de 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:

Más respuestas (0)

Categorías

Más información sobre Simulink Coder en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by