function Im=subImages(fileIndex,theDir,fileprefix); %function Im=sumImages(fileIndex,theDir); %adds tif files in fileIndex, under theDir, if no directory assumes current %doesn't use filenumbers, just the order in which they appear in the %directory %minus sign subtracts if nargin == 1 theDir = '.' end if nargin == 3 ImFiles =dir(strcat(theDir,'/',fileprefix,'*.tif')); else ImFiles =dir(strcat(theDir,'/*.tif')); end Im = zeros(195,487); for j=1:26 fprintf('adding file %s\n',ImFiles(j).name); Tot_counts_ON(j)=sum(sum(imageread(strcat(theDir,'/',ImFiles(j).name),'tif',[487,195],32))); Tot_counts_OFF(j)=sum(sum(imageread(strcat(theDir,'/',ImFiles(j+1).name),'tif',[487,195],32))); end