From: Attila Kovacs on
I am collecting signal from two potentiometers via an NI A/D board. I would like to present real-time feedback by plotting one signal against the other (lissajous figure)always using one pair of datapoints. To this end I use peekdata function and plot the returned values. The problem I run into is that peekdata does not return every single value and therefore the display is jumping between the values returned by peekdata. I would appreciate any suggestions on how to make the display move smoother. This occurs regardless the sampling frequency.

tempairunning=airunning;

if airunning==0;
start(ai)
airunning=1;
end

running=1;
set(stop_button,'Visible','On');
set(start_button,'Visible','Off');

% find channels to display
for ii=1:num_channel
onchannel(ii)=get(channel_check(ii),'Value');
end
goodchannel=find(onchannel==1);% logical operator

pause(1)
%-------------------------------------------
data=peekdata(ai,1)
%-------------------------------------------

hLine=[];
%--------------------------------------------
for ii=1:length(goodchannel)
hLine(ii)=line('Parent',haxes,...
'XData',data(:,1),...
'YData',data(:,2));
end
%--------------------------------------------
while running==1

if airunning==0;
start(ai)
end
%-------------------------------------------
data=peekdata(ai,1)
%-------------------------------------------
hLine=[];
%-----------------------------------------------------
for ii=1:length(goodchannel)
hLine(ii)=line('Parent',haxes,...
'XData',data(:,1),...
'YData',data(:,2),...
end
%---------------------------------------------------------
plot(data(:,1),data(:,2),'ro','MarkerEdgeColor','r',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',10);
xlim([-5 5]);
ylim([-5 5]);
drawnow

end