%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file: replayUSB.m                                                       %
%                                                                         %
% brief: This is a example for replaying 100 frames stored in a file.     %
%                                                                         %
% autor: Benedikt Radl                                                    %
%                                                                         %
% Copyright (c) 2014 Bluetechnix GmbH                                     %
%                                                                         %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

N=100;
frameTime = 0.5;


load('FrameBuffer');

%create window for distances
figure('name','Distance data');
set(gcf,'NumberTitle','off')
%set color range from 0 to 3
clims  = [0 3];
hDist = imagesc(squeeze(FrameBuffer(1,:,:)), clims);
colorbar;
cm=flipud(jet);
colormap(cm);

for i = 1 : N
    %display distances
    set(hDist,'CData',squeeze(FrameBuffer(i,:,:)));
    refreshdata(hDist);
    pause(frameTime);
end
    
clear all;
close all;