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!

 Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 30 de Oct. de 2012
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')

Más respuestas (0)

Categorías

Más información sobre Simulink Coder en Centro de ayuda y File Exchange.

Preguntada:

niu
el 30 de Oct. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by