Is possible to call a callback each time you change a property (in mytarget.tlc)?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I'm customizing one mytarget.tlc to add new options to my target. I need to put a checkbox so that when the 'on' do one thing and when 'off' do something else. But with the call: rtwoptions(5).Callback = MyCallback (hDlg, HSRC) '; This callback is only called when the property is changed the first time.
0 件のコメント
採用された回答
Kaustubha Govind
2012 年 2 月 23 日
What you are doing sounds correct and should work every time the property is changed - maybe there is some small error in implementation? I would recommend looking at an example that is shipped with the product. Look at the files usertarget.tlc and usertargetcallback.m in $matlabroot/toolbox/rtw/rtwdemos/rtwoptions_demo
This is what is used:
rtwoptions(4).prompt = 'Real-Time Interrupt Source';
rtwoptions(4).type = 'Popup';
rtwoptions(4).default = 'Timer';
rtwoptions(4).popupstrings = 'Timer|5|6|7|8|9|10|11|12|13|14|15';
rtwoptions(4).tlcvariable = 'tlcvariable3';
rtwoptions(4).callback = 'usertargetcallback(hDlg, hSrc, ''tlcvariable3'')';
I also tried adding this TLC file to the MATLAB path, and then used this as the System Target File in a test model. I could see the callback being executed every time the parameter was changed.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!