Borrar filtros
Borrar filtros

Is possible to call a callback each time you change a property (in mytarget.tlc)?

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 23 de Feb. de 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.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by