How to install select callback function in STF?
23 次查看(过去 30 天)
显示 更早的评论
I was trying to declare model reference compliance in STF. This is what i did to install select callback:
rtwgensettings.Version = '1';
rtwgensettings.SelectCallback = 'custom_select_callback_handler(hDlg, hSrc)';
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);
When I try to load the STF, I get following error:
Warning: The following error occurred processing the System Target File '':
Undefined function or variable 'hDlg'.
What am I missing?
Thanks.
0 个评论
采纳的回答
Kaustubha Govind
2012-11-30
The code:
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);
Should be defined in a separate MATLAB file named custom_select_callback_handler.m that should be present on the MATLAB path:
function custom_select_callback_handler(hDlg, hSrc)
slConfigUISetVal(hDlg, hSrc, 'ModelReferenceCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ModelReferenceCompliant', false);
slConfigUISetVal(hDlg, hSrc, 'ParMdlRefBuildCompliant', 'on');
slConfigUISetEnabled(hDlg, hSrc, 'ParMdlRefBuildCompliant', false);
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!