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!

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 10월 30일

0 개 추천

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')

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

질문:

niu
2012년 10월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by