How to load refernce model parameters with Callback " PreLoadFcn" for code generation?

8 Ansichten (letzte 30 Tage)
I am automating the code generation process by using a .m script that uses rtwbuild('MyModel') to initiate the build. 'MyModel' references a 'ReferenceModel'. This 'RefrenceModel' uses the callback PreloadFcn to run 'MyParameters.m'
My problem is that when I use rtwbuild('MyModel'), 'MyParameters.m' is never run so the build process errors out because none of my parameters are defined.
If I run 'MyParameters.m' before rtwbuild('MyModel') it builds fine. However, I don't want to have to run 'MyParameters.m' before rtwbuild('MyModel'). I thought the PreloadFcn callback should work.
Am I doing something wrong? Or do callback functions not work in reference models for rtwbuild?
Thanks,
FYI: MATLAB 2013b, Embedded Coder v6.5, Simulink Coder v8.5, MATLAB coder v2.5

Akzeptierte Antwort

Adam
Adam am 15 Nov. 2013
Bearbeitet: Adam am 15 Nov. 2013
After researching the Callback in the help, I found this nugget of info: http://www.mathworks.com/help/simulink/ug/using-callback-functions.html
At the bottom it says to avoid 'run' commands in callback code. Good to know!
Removed the 'run' command, left the name of the m script.
It now builds perfectly!

Weitere Antworten (0)

Kategorien

Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by