Matrix Buffer

Version 1.0.0.0 (1.75 KB) by Jan Wolff
Buffer Class to efficiently store blocks of data.
818 Downloads
Updated 7 May 2007

No License

This class implements a very simple but efficient way to temporarily store data.

This tool was created to store simulation data of a switching control system that is returned by the ode functions.

This class is NOT intended to store large numbers of small data chunks, for example single vectors. This class is intended to store an unknown number of matrices that match in one dimension. On read-out, the stored object are concatenated in one direction.

To store a large number of small data elements, preallocate memory by creating a matrix to hold several data elements. Store this matrix in the buffer class when filled and create a new one. Adaption of the size of the temporary
variable, for example doubling of the size with an upper bound, is a compromise between memory overhead and execution time.

It was kindly expressed by John D'Errico, that his tool (file-id 8334) solves a similar task.

methods of class buffer:
constructor - creates empty buffer
store - stores a matrix in the buffer
flush - reads out the buffer concatenating the elements in rows (default) or columns.

example:

buf = buffer
buf = store(buf,eye(3))
buf = store(buf,eye(3))
flush(buf)
flush(buf,1)

Cite As

Jan Wolff (2024). Matrix Buffer (https://www.mathworks.com/matlabcentral/fileexchange/14087-matrix-buffer), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Performance and Memory in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0

A typo in the example code is corrected.