How to use the Build/Reload&Run block in Simulink

Hi, I'm study on the Embedded Coder now, and I'm confused by a block "Build/Reload&Run",which I find in a demo named c2000rtdxtest.mdl. The contents of the "OpenFcn" in the "Block Properties" is "demo_script = get_param(gcb, 'UserData'); feval(demo_script);" But if I drag a new "Build/Reload&Run" block from library, It doesn't work when I double-click on it. The contents of the "OpenFcn" is the same as to the original one. I have been work on this question for days, what on earth the problem is? Thanks very much!

 Akzeptierte Antwort

Kaustubha Govind
Kaustubha Govind am 30 Okt. 2012

0 Stimmen

My guess is that get_param(gcb, 'UserData') returns the name of a MATLAB script whose contents refer to specifics of the demo model, which don't apply to your model. You could create a copy of that function and modify it to your own needs, and set that as the function to use with a command similar to (run after selecting the Build/Reload&Run block with your mouse):
>> set_param(gcb, 'UserData', 'myfunction')

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Coder finden Sie in Hilfe-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