2

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.

pnuts
  • 58,317
  • 11
  • 87
  • 139
  • Depending on the macros, they can actually make the code *less* readable. – Some programmer dude Jan 26 '15 at 15:10
  • Here it would really help and more important, it is mandatory. – soso_eeckhout Jan 28 '15 at 07:03
  • 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 Mar 04 '16 at 10:46

1 Answers1

1

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.