Matrix Buffer
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
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
@buffer/
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 | A typo in the example code is corrected. |