简体   繁体   English

如何指定保存在 -v7.3 matfile 中的大数组的块大小?

[英]How to specify the chunksize of large array saved in -v7.3 matfile?

I'm saving large data array to mat file.我正在将大数据数组保存到 mat 文件中。

m = matfile('data.mat','writable',true);
m.X(1000,1000,10,50000) = nan(1,'single');
for ii = 1 : 50000
  % do some computation
  m.X(1:1000,1:1000,1:10,ii) = Y;
end

How can I set ChunkSize of X to [1000,1000,1,1]?如何将X ChunkSize 设置为 [1000,1000,1,1]?

You can't use the matfile command, but you use the HDF5 api.您不能使用matfile命令,但可以使用 HDF5 api。 Since matfiles v7.3 use the HDF5 format , i guess it should also work on the reading side for you?由于matfiles v7.3 使用 HDF5 格式,我想它也应该适用于您的阅读方面? Here is a small example from the documentation:这是文档中的一个小例子:

h5create('myfile.h5','/DS3',[20 Inf],'ChunkSize',[5 5]);
for j = 1:10
      data = j*ones(20,1);
      start = [1 j];
      count = [20 1];
      h5write('myfile.h5','/DS3',data,start,count);
end
h5disp('myfile.h5');

Source of the example示例来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM