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!

 Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Deployment, Integration, and Supported Hardware in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by