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

1 件のコメント

niu
niu 2012 年 10 月 31 日
Thankyou! O(∩_∩)O~

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by