Dear experts,
this is Carlos Andreu. Several months ago, You helped me to refresh continously a textbox with a timer function. This solution has worked perfectly. Now, I would like to add other timer function in order to refresh two text boxes at the same time. I have tried it with the following code:
function myGUI(handles,hObject)TimerH = timer('UserData', handles.text5, 'TimerFcn', @myTimerFcn, 'Period', 0.5, ... 'ExecutionMode', 'fixedRate');drawnow;TimerH2 = timer('UserData', handles.text9, 'TimerFcn', @myTimerFcn2, 'Period', 0.6, ... 'ExecutionMode', 'fixedRate');drawnow;start([TimerH TimerH2]);function myTimerFcn(TimerH,eventData,handles,hObject)global distanceglobal flag_trackerif flag_tracker == 1 TextH = get(TimerH, 'UserData'); distancia = Guardar_pos(TextH); pause(0.5) set(TextH,'String',num2str(distance)) drawnow();else TextH = get(TimerH, 'UserData'); set(TextH,'String','Measuring...');endfunction myTimerFcn2(TimerH2,eventData,handles,hObject)global distance2global flag_trackerif flag_tracker == 1 TextH2 = get(TimerH2, 'UserData'); distancia_fija = Guardar_pos3(TextH2); pause(0.5) set(TextH2,'String',num2str(distance2)) drawnow();else TextH2 = get(TimerH2, 'UserData'); set(TextH2,'String','Measuring...');end
The problem is the textbox of timerH works, but textbox of timerH2 doesn't.
Please, Can you help me?
Thank you in advance,
Carlos.
Best Answer