- Save the variables in a .mat file and use ‘coder.load’ to import them as constants during code generation. This embeds the values directly into the generated code.
- For scenarios where variables need to be loaded at runtime, use ‘coder.write’ to generate ‘coderdata’ files and access them dynamically using ‘coder.read’.
- Alternatively, for signal or time-series data, you can use From Workspace or From File blocks to load data into the model.
- https://www.mathworks.com/help/simulink/slref/coder.load.html
- https://ww.mathworks.com/help/coder/ug/generate-code-that-reads-and-writes-data-files.html