Relation between header and Simulin.bus objects
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am considering to use the legacy code tool as suggested in
to compile a large bunch of code into an S-Function on Matlab 2007b. I would like to use buses and I am folliwing the example in sldemo_lct_bus_script.m, the problem is that I DO have the header files with the typedef structs definition of the buses, but I DONT have the simulink.bus object files. It seems that I will have to manually build these objects making sure they are coherent with the typedef struct definitions on the header.
My questions are:
- why does LCT needs the redundant simulink.bus object in the workspace if this information is already contained in the header files as a typedef struct?
- is my responsibility to guarantee that the headers and the simulink.bus objects are coherent with each other? this is error prone, time-expensive and must be done each time the header files changes (game stopper probably).
- is there a way to convert from the header files to simulink.bus objects automatically?
thanks for your feedback on these matters.
0 Kommentare
Akzeptierte Antwort
TAB
am 26 Feb. 2013
Bearbeitet: TAB
am 26 Feb. 2013
Q: why does LCT needs the redundant simulink.bus object in the workspace if this information is already contained in the header files as a typedef struct?
A: Header files are used by c compilers. Matlab can not import or understand the struct definitions in c format. So it need a equivalent declaration in the form of Simulink.Bus object.
----------
Q: is my responsibility to guarantee that the headers and the simulink.bus objects are coherent with each other?
A: Yes you have to take care if you want to import the structure declaration from external header. OR simply do not use external header for defining structure. Instead generate the structure definition header from simulink (See last heading).
----------
Q: is there a way to convert from the header files to simulink.bus objects automatically?
A: You can write a matlab script to read the header file and generate the equivalent Simulink.Bus object.
----------
Best option for you:
If you do not want to write the definition at two places, simply set the DataScope field of Simulink.Bus object to Exported. This will force simulink to generate the structure definition header file from Simulink.Bus object.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Modeling finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!