- HDF4 and HDF5 files, where it reflects terminology used by those file formats
- https://www.mathworks.com/help/simulink/slref/matlab.io.datastore.sdidatastore.read.html
what is the difference between data chunk and buffer in matlab?
4 views (last 30 days)
Show older comments
i want to know difference between chunk data and buffer by example
if i have a large file that i just want to read part of it each time what the differece of both
Thanks
0 Comments
Accepted Answer
Walter Roberson
on 21 Jul 2019
MATLAB does not generally use the term "data chunk". It does occur in some contexts:
Generally speaking, a data chunk is a decoded valid subset of data, such as a certain number of rows of input. Generally speaking, a buffer is often an undecoded portion of data that might not happen to nicely align with a number of rows. For example, a "buffer" of data might happen to be exactly 8 kilobytes for I/O efficiency, and that might happen to end in the middle of a number.
3 Comments
Walter Roberson
on 21 Jul 2019
Potentially, but it depends what you are doing. MATLAB is not strong on "stream I/O"
An example of a situation in which it is possible is any of the serial-like I/Os, whether from serial port or from udp or tcp . You can configure an input buffer, and you can configure a callback when it gets to a certain size. At that point, you can read from object, which implicitly reads from the buffer, and you can do that reading using (for example) fscanf() requesting a particular size of result, which you would have calculated as being safely within the buffer size because you know the maximum field widths for each item and so can calculate the mininum number of parseable objects in the buffer.
For files, you can fread() a fixed amount of uint8=>char for efficiency, putting it into your own buffer. Then you can textscan() from the buffer, and record both outputs; the second output tells you how much of the buffer you used up. Save off the unused part to prepend to the next chunk of data.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!