Hi all,
I have been searching for the problem with this for quite a while and I am just not seeing what the problem is. I have a class that runs a timer that reads values from some hardware and displays them on a GUI. I am having trouble with the timer. here is the relevant code:
classdef Controller < handle
properties (Access = private)
gui_h;
ControllerObj;
positionTimer;
end
methods
function this = Controller()
this.gui_h = guihandles(Controller_fig);
this.ControllerObj = PI_GCS_Controller();
this.positionTimer = timer('BusyMode','drop','ExecutionMode','fixedRate','Period',1,'TimerFcn',@this.positionTimerFcn);
start(this.positionTimer);
end
methods (Access = private)
function this = UpdatePositionAndVoltage(this)
end
function this = positionTimerFcn(this,src,event)
this.UpdatePositionAndVoltage(this);
end
end
end
If I run this with the call to UpdatePositionAndVoltage commented out, and just disp a string to the command line, it works fine. the timer triggers at once per second. if I try to call this.UpdatePositionAndVoltage(this) I get the error message "Error while evaluating TimerFcn for timer 'timer-1' Too many input arguments." If I change the definition of Update... to UpdatePositionAndVoltage(this,~) I then get the error message "Error while evaluating TimerFcn for timer 'timer-1' No appropriate method, property, or field Controller for class Controller."
which seems like it is at least making it into the Update function, but the "Controller" is not defined in there? I am just not seeing what the problem is. I also tried passing in "this" as a parameter in the timer definition, but that didn't work either.
any insight would be greatly appreciated!
thanks, mln