set_param and callback argument
古いコメントを表示
Hello,
I have a syntax question. I would like to use the set_param function to define a callback Startfcn of a simulink block. How can I put an argument to my Startfcn function ?
For example : modelName = 'sim_model.mdl' function_name = 'start_function' set_param(modelName,'StartFcn',function_name);
For example, my Startfcn is like this :
function start_function(abc) display(abc) end
Thnak you in advance.
採用された回答
その他の回答 (1 件)
Christophe
2011 年 10 月 24 日
5 件のコメント
TAB
2011 年 10 月 24 日
Your question is not clear to me.
You can write string 'start_function(abc)' to StartFcn directly by
set_param(modelName,'StartFcn','start_function(abc)'). When you will run the model argment abc will be resolved from base workspace.
Or are you want to pass the *value of abc* to start_function from the set_param() directly ?
Christophe
2011 年 10 月 25 日
TAB
2011 年 10 月 25 日
Please see edited part of my previous answer.
Christophe
2011 年 10 月 25 日
TAB
2011 年 10 月 25 日
I have to again guess how your structure will be.
Please give some datails. If you can not post original data, express it with examples.
カテゴリ
ヘルプ センター および File Exchange で Model, Block, and Port Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!