Is possible to call a callback each time you change a property (in mytarget.tlc)?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 23 Feb. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Strategy & Logic finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!