Guest User

Untitled

a guest
Jun 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. buffSize = 10;
  2. circBuff = nan(1,buffSize);
  3. for newest = 1:1000;
  4. circBuff = [newest circBuff(1:end-1)]
  5. end
  6.  
  7. nBuffer = 10; % You can set this to whatever number of time points
  8. % you want to store data for
  9. nSamples = 2; % You can set this to the number of data values you
  10. % need for each point in time
  11. centroidBuffer = zeros(nSamples,nBuffer); % Initialize the buffer to zeroes
  12.  
  13. keepLooping = true;
  14. while keepLooping,
  15. % Capture your image
  16. % Compute the centroid data and place it in the vector "centroidData"
  17. centroidBuffer = [centroidBuffer(:,2:end) centroidData(:)];
  18. % Do whatever processing you want to do on centroidBuffer
  19. % Choose to set keepLooping to false, if you want
  20. end
  21.  
  22. keepLooping = true;
  23. processTime = 0;
  24. while keepLooping,
  25. % Capture your image
  26. % Compute the centroid data and place it in the vector "centroidData"
  27. centroidBuffer = [centroidBuffer(:,2:end) centroidData(:)];
  28. processTime = processTime+1;
  29. if (processTime == nBuffer),
  30. % Do whatever processing you want to do on centroidBuffer
  31. processTime = 0;
  32. end
  33. % Choose to set keepLooping to false, if you want
  34. end
  35.  
  36. ...
  37. if (processTime == nBuffer/2),
  38. ...
Add Comment
Please, Sign In to add comment