From 6c8fc9dbdfd37f648a7cf81f7e7dafdc5d7a668f Mon Sep 17 00:00:00 2001 From: Florian Rau Date: Wed, 9 Mar 2022 19:23:58 +0100 Subject: [PATCH] discontinuous line if samples were skipped --- software/MATLAB/BpodStepperLive.m | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/software/MATLAB/BpodStepperLive.m b/software/MATLAB/BpodStepperLive.m index d96b1f3..ee183c9 100644 --- a/software/MATLAB/BpodStepperLive.m +++ b/software/MATLAB/BpodStepperLive.m @@ -75,13 +75,19 @@ function update(obj,~,~) if isnan(obj.data(1,end)) obj.data(1,:) = obj.data(1,:) + incoming(1)/1E3; end - - tmp = nan(4,1); - tmp(1) = incoming(1) / 1E3; % time-stamp - tmp(2) = obj.vDiv ./ incoming(3); % velocity - tmp(3) = abs(tmp(2)-obj.data(2,end)) / obj.ts; % acceleration - tmp(4) = bitand(1023, incoming(2)); % load - obj.data = [obj.data(:,2:end) tmp]; + + tmp = nan(4,1); + tmp(1) = incoming(1) / 1E3; % time-stamp + tmp(2) = obj.vDiv ./ incoming(3); % velocity + tmp(3) = abs(tmp(2)-obj.data(2,end)) / obj.ts; % acceleration + tmp(4) = bitand(1023, incoming(2)); % load + + if incoming(1) / 1E3 > obj.data(1,end) + 1.5 * obj.ts + tmp(3) = NaN; + obj.data = [obj.data(:,3:end) nan(4,1) tmp]; + else + obj.data = [obj.data(:,2:end) tmp]; + end [obj.h.plot.XData] = deal(obj.data(1,:)-obj.data(1,end)); obj.h.plot(1).YData = obj.data(2,:);