When does Simulink.Bus generate header files?
21 次查看(过去 30 天)
显示 更早的评论
Hi there,
I have a problem with the code generation in a S-Function Builder block: A part of my model is C-Code that is listet as a library in the library tab of the S-Function Builder block. My Model also uses Buses and the C-Code uses these Buses as structs. The static input data for the model lives in the workspace and are MATLAB-structs that are converted to Simulink.Bus objects. When I set the Bus objects data scope property to 'Auto' and do not provide a Header file name, the builder block generates a sfunname_bus.h header file that works like a charm if I include it in the library C file.
If I do provide a header file name for the bus and set the data scope to 'Exported', the builder block fails to compile the code, complaining that the header files are missing, which makes sense because no header files are generated.
How can I force header file generation of the Simulink.Bus object before the builder block starts the compilation process?
1 个评论
Friedrich Welck
2019-9-27
编辑:Friedrich Welck
2019-9-27
Seven years later I'm having the exact same problem.
There is no solution given here. Is there a solution now?
For reference:
I want to generate C-code and I want the bus-definitions to end up in a header file named 'shared_types.h'.
If I set the DataScope of my bus to 'Auto' and set HeaderFile to '' the definition ends up in <model_name>_types.h
If I set the DataScope of my bus to 'Exported' and set HeaderFile to '' nothing happens. No bus definition is created.
If I set the DataScope of my bus to 'Exported' and set HeaderFile to 'shared_types.h' nothing happens. No bus definition is created.
I am using Matlab 2017b
回答(1 个)
Kaustubha Govind
2012-6-25
Not sure if I've understood your question correctly, but shouldn't the solution be to set the data scope to "Auto" as you've already discovered? Setting it to "exported" is incorrect unless you have existing header files that define the structure of the Bus object.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Composite Interfaces 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!