When compiling a Simulink model into an executable, there isn’t a built-in mechanism to automatically read external parameters at startup. One common solution is to add code in one of the model callbacks (for example, the PreLoadFcn or InitFcn) that reads parameters from an external source (such as a MAT file or environment variables) and then assigns them to the model workspace using set_param. Alternatively, you can create a custom main function that accepts command‐line arguments, uses those arguments to set parameters via set_param (or by writing to the model workspace), and then starts the simulation. This custom main function can be compiled along with your model using mcc. Both approaches allow you to set parameters at initialization without manually modifying generated C or header files.
Follow me so you can message me anytime with future questions. If this helps, please accept the answer and upvote it as well.