UPDATE:
Since I now understand that you need a circular buffer for storing data, here is a solution you can use. Since you said that you store data on the centroids of objects in the image, I will give you a general case for storing an arbitrary number of dimensions (index value of 1 pixel for each centroid or 2 values for x and y coordinates, etc.), ...
Initialize the buffer first:
nBuffer = 10; % You can set this to whatever number of time points
% you want to store data for
nSamples = 2; % You can set this to the number of data values you
% need for each point in time
centroidBuffer = zeros(nSamples,nBuffer); % Initialize the buffer to zeroes
. while loop , TRUE ( FALSE, ):
keepLooping = true;
while keepLooping,
% Capture your image
% Compute the centroid data and place it in the vector "centroidData"
centroidBuffer = [centroidBuffer(:,2:end) centroidData(:)];
% Do whatever processing you want to do on centroidBuffer
% Choose to set keepLooping to false, if you want
end
: ( ) centroidBuffer ( ), , .
, nBuffer, , :
keepLooping = true;
processTime = 0;
while keepLooping,
% Capture your image
% Compute the centroid data and place it in the vector "centroidData"
centroidBuffer = [centroidBuffer(:,2:end) centroidData(:)];
processTime = processTime+1;
if (processTime == nBuffer),
% Do whatever processing you want to do on centroidBuffer
processTime = 0;
end
% Choose to set keepLooping to false, if you want
end
EDIT:
. , 10 , nBuffer 20, 10 , 10 , if :
...
if (processTime == nBuffer/2),
...
, 10 ( centroidBuffer (:, 1:10)), 10 ( centroidBuffer. (:, 11:20))