callback function handle syntax inside objects?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have an object that generates a gui and controls some external equipment. I am trying to set things up so that a particular button press on the gui sends a particular command to the external equipment (without success). The command is sent using one of the object methods.
Example:
cg=CCUCGUI('10.0.1.1');
cg.navi('up');
The above code works, but my numerous attempts to create a callback inside the object contructor have failed miserably.
I have tried the following and more, but my understanding of callback function handle syntax is clearly insufficient to the task.
set(obj.guiobj.buttonup,'Callback','obj.navi(''up'');');
%Note the above executes, but 'obj' does not exist in main MATLAB workspace
set(obj.guiobj.buttonup,'Callback',@() obj.navi('up'));
set(obj.guiobj.buttonup,'Callback',{@() obj.navi('up')});
set(obj.guiobj.buttonup,'Callback',{@('up') obj.navi});
set(obj.guiobj.buttonup,'Callback'{@obj.navi,'up'});
tmp='up';set(obj.guiobj.buttonup,'Callback',@(tmp) obj.navi);
tmp='up';set(obj.guiobj.buttonup,'Callback',{@(tmp), obj.navi});
Any help would be appreciated, Thanks, Sean
Siehe auch
Kategorien
Mehr zu Environment and Settings 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!