Hi @Alan Martínez - the default timer function callback signature takes two inputs only. You are using that default definition here
m_timer_daq.TimerFcn = @timerDAQ_callback_1;
but you have defined a timer callback function with three input parameters
function timerDAQ_callback_1(obj, event,handles)
and so the error message of there "not being enough input parameters" makes sense: the default definition is passing two, but your signature expects three. If you want to pass a custom (third) parameter into your callback, you need to do that when you assign the callback to your timer. Try the following
m_timer_daq.TimerFcn = {@timerDAQ_callback_1, hObject}
Since I am using hObject (the figure/GUI handle) instead of handles then you need to change your callback timer code to
function timerDAQ_callback_1(obj, event, hFigure)
handles = guidata(hFigure);
obj.UserData = obj.UserData + 1;
global ctu
global salida_f
ctu=ctu+1
disp(salida_f)
plot(handles.axes1,salida_f);
I do this because when you pass handles as a parameter to your timer callback, it is a copy of the handles structure only. So any changes to this object will not persist outside of the callback function (though you aren't making any changes anyway so I suppose it doesn't matter).
Also, consider removing the global parameters. I see that you are using them between the start and DAQ callback functions. Just save them to the handles structure instead.
Oh - I see that you will have the same problem with the start timer callback. You need to change that as well:
m_timer_daq.StartFcn = {@start_timer_callback, 'My start message', hObject};
and
function start_timer_callback(obj, event, text_arg, hFigure)
handles = guidata(hFigure);
handles.ctu = 0;
handles.salida_f = 0; % is this correct? salida_f is never assigned...
guidata(hFigure, handles); % save the updated handles structure
time = 0;
txt1 = ' event occurred at ';
txt2 = text_arg;
event_type = event.Type;
event_time = datestr(event.Data.time);
msg = [event_type txt1 event_time];
disp(msg)
disp(txt2)
tic
Then use handles in the timerDAQ_Callback to get the ctu and salida_f (which never appears to be set).