% read_chunk.m - function to read a movie chunk
%
% function F = read_chunk(dataroot,i,imsz,imszt)
%
% dataroot:  path (string)
% i:         which chunk you want to read
% imsz:      spatial size
% imszt:     number of frames

function F = read_chunk(dataroot,i,imsz,imszt)

filename=sprintf('%s/chunk%d',dataroot,i);
fprintf('%s\n',filename);
fid=fopen(filename,'r','b');
F=reshape(fread(fid,imsz*imsz*imszt,'float'),imsz,imsz,imszt);
fclose(fid);
