Search code examples
matlabmatlab-app-designer

Error while evaluating TimerFcn for timer.. Too many input arguments. MATLAB


The problem with a timer in the MatLab App Designer. It return an error: "Error while evaluating TimerFcn for timer.. Too many input arguments"

my code:

app.t.TimerFcn = @app.timerFunction;
function timerFunction(app, ~, ~)

    %something

end

I've been looking for a solution. I also tried this:

app.t.TimerFcn =  @(app, ~, ~)app.timerFunction
timerFunction(app, ~, ~)
app.t.TimerFcn =  @(~,~)app.timerFunction
timerFunction(app)

Any help would be appreciated.


Solution

  • The found solution is:

    callback function:

    function timerFunction(app)
        % stuff
    end
    

    timer settings

    app.t.TimerFcn =  @(x,y)timerFunction(app);