Is possible to call a callback each time you change a property (in mytarget.tlc)?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Kaustubha Govind
le 23 Fév 2012
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Environment and Settings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!