h=load_labjack;
oldstr = num2str(lj_get(h));

imax = 800;
data = zeros(1,imax);
for i=1:imax
    data(i) = lj_get(h);
% 
%     fprintf([repmat('\b',1,length(oldstr)), '%s'],newstr );
% 
%     oldstr = newstr;

    lj_step(h);

    %if rem(i,3000)== 0

        %pause(5);

    %end
% 
%     pause(.00000001)
% 
%     A(i)=str2num(newstr);
%     i=i+1;

% Here is a trick from Nightvid to start and stop the motor slowly:
enddist = imax/2 - abs(i-(.5+imax/2));
pause(.03/(enddist/10))
% End of the trick


end

figure(1);

plot(1:imax,data)
