function Nbeamlets = beamletNum(folder,Nbatches) Nbeamlets = 0; beamletFolder = [folder]; for i=1:Nbatches; temp = open_beamlet_batch([beamletFolder '/beamletbatch' num2str(i-1) '.bin']); Nbeamlets = Nbeamlets + length(temp); disp(int2str(i)); end fprintf(['Max beamlet number = ' num2str(temp{length(temp)}.num) '\n']); fprintf(['Number of beamlets = ' num2str(Nbeamlets) '\n']); end