When does Simulink.Bus generate header files?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Friedrich Welck
el 27 de Sept. de 2019
Editada: Friedrich Welck
el 27 de Sept. de 2019
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
Respuestas (1)
Kaustubha Govind
el 25 de Jun. de 2012
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.
Ver también
Categorías
Más información sobre Composite Interfaces 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!