function X = f(dir,n,Size) % % Syntax: X = read_uchars(dir,n,Size) % % Loads the index n unsigned char (1 byte/pixel) DAT images from % directory dir and returns them in a N-by-M matrix, where N is % the total dimensionality of the image (nrow*ncol) and M is the % number of elements in the index vector n % Author: baback@media.mit.edu % Date : 05/23/93 N = length(n); X = zeros(Size(1)*Size(2),N); for i=1:N fname = [dir '/data' int2str(n(i))]; fid = fopen(fname); if fid==-1 disp(['ERROR: fopen failed on filename: ' fname]) return; end; x = fread(fid,fliplr(Size),'uchar')'; fclose(fid); X(:,i) = x(:); end;