2
votes

I am building a Simulink model in order it generates the C-code equivalent. Actually, the C-code doing that already exists but I want to visualize it with Simulink. I know that the code Simulink will generate will not be the same than the one it is based on, but there are some functionalities I want to keep. For example, I use a lot of Macro (#define) in the C code, to be more readable and I really do not know how to force Simulink to define these macro's. So my question is, which object/structure/data should I create and where (model workspace or Matlab workspace?) such that when C code will be generated, all my macro's will be defined with preprocessor commands.

I thank you a lot for any lead you could propose.

1
Depending on the macros, they can actually make the code less readable. - Some programmer dude
Here it would really help and more important, it is mandatory. - soso_eeckhout
Now my problem is that Simulink introduces a cast in my macro definition when generating the code. I would prefer to have nothing. This is actually possible if I keep the type double but I am working with fixed-point types. What can I do to combine both constraints? Fixed point + no cast in code generation. This latter request is a constraints from the existing code... - soso_eeckhout

1 Answers

1
votes

Finally I found my answer in this huge user guide

https://engineering.purdue.edu/~dionysis/EE452/Lab2/Lab2_Supporting_Materials/Embedded%20Coder_Users%20Guide.pdf

I had to use mpt.Parameter Imported from file and check Inline parameter option.