Remember to insert a drawnow to let Matlab update the contents of the figure. This is most likely the solution of your problem. But some hints in addition:
Insert
guidata(hObject, handles);
only after the contents of the handles struct was changed. Therefore the last two lines of startCom_Callback() can be removed.
You do not have to provide the handles struct as input, if you request its current values also. Therefore this is enough:
configureCallback(s, "terminator", @(src, evt) displaySerial(src, evt, hObject))
and
function displaySerial(src, evt, hObject)
handles = guidata(hObject);
...
The lines:
a = strrep(data,',',' ');
C = string(strsplit(a));
a=str2double(C);
can be simplified to:
a = sscanf('%g,', data, [1, inf]);
Again, because the handles struct has not been changed, there is no reason to update its value in the figure. So omit "guidata(hObject, handles);" here.
Best Answer