MATLAB:.mat 版本之间的差异
官方文档声明如下:
。但我注意到除了上表中所述的差异之外,还有其他重要的差异。
例如,在 MATLAB 中保存一个包含约 6,000 个元素、占用 176 MB 内存的元胞数组,根据我使用的是 -v7 还是 -,会得到以下结果v7.3:
- 使用 -v7:文件大小 = 15 MB,然后保存并保存负载快。
- 对于 -v7.3:文件大小 = 400 MB,然后保存并保存加载非常慢(可能部分是因为文件太大)。
还有其他人注意到这些差异吗?
更新 1:正如回复所指出的,-v7.3 依赖于 HDF5,并且根据 Mathworks 的说法,“这种格式具有显着的存储开销”,尽管尚不清楚此开销是否确实是由于格式本身造成的,还是由于 MATLAB 实现和 HDF5 的处理造成的。
更新 2:@Andrew Janke 向我们指出这个非常有用的 PDF< /a> (显然在网络上不提供 HTML 格式)。有关更多详细信息,请参阅@Amro 提供的答案中的评论。
这一切都让我想到下一个问题:是否有任何替代方案能够结合两全其美的优点(例如-v7的效率和处理非常大文件的能力-v7.3)?
The official documentation states the following:
. But I have noticed that there are other important differences besides those stated in the table above.
For example, saving a cell array with about 6,000 elements that occupies 176 MB of memory in MATLAB gives me the following results depending on whether I use -v7 or -v7.3:
- With -v7: File size = 15 MB, and save & load is fast.
- With -v7.3: File size = 400 MB, and save & load is very slow (probably in part because of the large file size).
Has anybody else noticed these differences?
Update 1: As the replies point out, -v7.3 relies on HDF5 and according to Mathworks, "this format has a significant storage overhead", although it's not clear if this overhead is really due to the format itself, or to the MATLAB implementation and handling of HDF5 instead.
Update 2: @Andrew Janke points us to this very helpful PDF (which apparently is not available in HTML format on the web). For more details, see the comments in the answer provided by @Amro.
This all takes me to the next question: Are there any alternatives that combine the best of both worlds (e.g. the efficiency of -v7 and the ability to deal with very large files of -v7.3)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MAT 文件的 7.3 版本使用 HDF5 格式,这种格式在描述文件内容时会产生大量存储开销,特别是对于复杂的嵌套单元阵列和结构。与以前版本的 MAT 文件相比,它的主要优点是它允许在 64 位系统上存储大于 2GB 的数据。
请注意,v7 和 v7.3 都经过压缩并使用 Unicode 编码(与 v6 不同),但它们是两种完全不同的格式...
参考文献:
Version 7.3 of MAT-files uses HDF5 format, this format has a significant storage overhead to describe the contents of the file, especially so for complex nested cellarrays and structures. Its main advantage over previous versions of MAT-files is that it allows storing data larger than 2GB on 64-bit systems.
Note that both v7 and v7.3 are compressed and use Unicode encoding (unlike v6), yet they are two completely different formats...
References: