if get(hObject,'Value')
warning off;
bt = getappdata (handles.main_ex_figure, 'bt_connection');
fprintf (bt, 'START');
t = datetime('now');
// filename = fopen(strcat(strrep(datestr(t), ':', ''),'.txt'), 'a');
// h = handles.AxesGraph;
// axes(h);
a = animatedline(handles.AxesGraph);
tic
while get(hObject,'Value')
str = fscanf(bt);
if ~isempty(str)
data = strsplit(str, ',');
dataString = data{2:length(data)-1};
tmp = str2double(dataString);
addpoints(a, toc, tmp);
hold on
drawnow limitrate
end
end
hold off
// fclose (filename);
else
bt = getappdata (handles.main_ex_figure, 'bt_connection');
fprintf (bt, 'STOP');
end
0 Comments
Sign in to comment.