Simulink.Bus and Embedded Coder
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a few Matlab files that work correctly and implement the functionality I need. I am now trying to port them to Simulink/Embedded Coder using the "Matlab Function" block. After resolving a number of "not supported" type problems, I am stuck on a problem that I don't know how to resolve.
The issue is this- the Matlab functions use a structure to keep track of the system state. They modify the state and pass it on to each other. Embedded Coder indicated that structs were not supported, so I added the following line that I found in a Matlab blog post- "outputState = Simulink.Bus.createObject(state);"
That seemed to improve things in that Embedded Coder got "farther". Now, though, it says the following- "Function 'Simulink.Bus' is not supported for code generation. Consider adding coder.extrinsic('Simulink.Bus') at the top of the function to bypass code generation." I tried adding the extrinsic, but it just came up with another error.
Can you use structs in Embedded Coder? If so, what do I need to do. I could break the state struct into individual values/arrays, but it would be very ugly and painful. Thanks for your time and help.
0 comentarios
Respuesta aceptada
Kaustubha Govind
el 5 de Nov. de 2012
You need to specify the Bus type on the Ports and Data Manager of the MATLAB Function block, not in the MATLAB code itself. Please see Attach Bus Signals to MATLAB Function Blocks.
2 comentarios
Kaustubha Govind
el 6 de Nov. de 2012
Signals whose size changes during simulation are called variable-size signals. I don't think variable-size signals can have an empty size (at least as of R2012b), but you can certainly have a variable-size signal as an element of a bus. See How can I create an output bus with variable dimensions using a structure in Embedded MATLAB?
Más respuestas (0)
Ver también
Categorías
Más información sobre Timers and Scheduling en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!