I'm saving large data array to mat file.
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]?
You can't use the matfile
command, but you use the HDF5 api. Since matfiles v7.3 use the HDF5 format, i guess it should also work on the reading side for you? 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');