- Download and extract "ceval_struct.zip" into its own directory
- Execute:
Is there an example of using Simulink buses with "coder.ceval" to handle structured data?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 11 Dec 2019
Answered: MathWorks Support Team
on 11 Dec 2019
Is there an example of using Simulink buses with "coder.ceval" to handle structured data?
Accepted Answer
MathWorks Support Team
on 11 Dec 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:
>> 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:
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulink Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!