DLL generated by simulink, how can I initialize parameters from an external file?

3 次查看(过去 30 天)
Hi there,
I have managed to generate a dll in Simulink. This simulink model has several parameters which I load from the workspace and then I compile it for the dll generation. However I would like to load those parameters (they only need to be loaded at the start of the simulation) from an external source (it might be an ASCII file or a mat file or m file or whatever) so I don't have to recompile every time I want to run a simulation.
Note that the dll is going to be called by an external software and therefore I don't want Matlab involved in the simulation process after the dll has been generated.
Those parameters are numbers, vector and matrices.
Maybe the easiest way to understand how to proceed is thinking about my model as a simple example: gain block one input, one output, one parameter (gain block). How can I call an external file to initialize parameters from my simulink-generated dll? perhaps Tunable parameters??????
Any ideas?
Thanks in advance.

回答(2 个)

Kaustubha Govind
Kaustubha Govind 2012-11-15
You can represent your Gain parameter using a Simulink.Parameter object with the Storage class set to ImportedExtern.

Jose Martinez
Jose Martinez 2012-11-16
Thanks for the quick reply. I guess I will need to use the header file to initialize my parameters.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by