Simulink.Bus and Embedded Coder
19 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Kaustubha Govind
2012-11-5
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 个评论
Kaustubha Govind
2012-11-6
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Timers and Scheduling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!