- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2019-7-21
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 个评论
Walter Roberson
2019-7-21
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!