I have a timer function that ticks every second and calls a display update function:
function update_display(hObject,eventdata,hfigure)
handles = guidata(hfigure);
set(handles.main_plot, 'XData', [1:length(handles.data)],'YData',handles.data)
drawnow
guidata(hfigure, handles);
Problem is, the plot doesnt update.I know the function is entered. Also in the program there is a bytesavailablefcn that triggers and harvests data from the serial port:
function update_function(hObject,eventdata,hfigure)
handles = guidata(hfigure)
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
handles.data(handles.count) = (fread(handles.s, 1,'uint8'));
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
fread(handles.s, 1,'int8');
handles.count = handles.count + 1;
handles.s.BytesAvailable;
handles.s.ValuesReceived;
guidata(hfigure, handles)
There's about 540 bytes arriving per second, and the function harvests every 9 bytes (so 60 times a second) but this doesnt seem to be the issue.
I know that the timer callback is being executed every second, it should be uninterruptible by default I read. Could it be because there are too many values in the array to plot? I am suspicious that the timer callback function is actually being interrupted.
Can anyone see where I'm going wrong?
Cheers