Here is something I just threw together that does what I think I need. Not sure how to handle the memory though. If there are a lot of measurements, the memory would fill pretty quickly.

Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!