function arr = readimgs(imn,n) %readimgs('basefilename',n) %- A function to load a series of .raw files outputted by 'take' %and stored in /opt/EDTpdv/JKimg/ % Inputs: 'basefilename' is a string input (for example, for series of % images "testpat####.raw" input 'testpat'). "n" is the number of images, % so for testpat0000-testpat0004 input n=5 i=0; arr=[]; %go into loop for each image while i9 I = ['00' int2str(i)]; end if i>99 I = ['0' int2str(i)]; end if i>999 I = [int2str(i)]; end %concatenate strings into filename fnm=['/opt/EDTpdv/JKimg/' imn I '.raw']; %load array from that filename fid = fopen(fnm,'r'); singarr = (uint16(fread(fid,[1024,1024],'uint16')))'; fclose(fid); arr = cat(3,arr,singarr); %add 1 to iteration # and restart loop i = i+1; end end