%function C = loadFaceMat(imgdir);
%
%Loads a directory of images into the rows of C.
%imgdir is a string with the path to the directory containing the images.
%For example:
%imgdir = 'C:\Documents and Settings\Marian Bartlett\My Documents\TestDir\AlignedFaceImages\'

cd (imgDir)
r = dir;

C = []
for i = 3:(size(r,1))
   t = r(i).name;
        I=imread(t);
      tmp=mat2gray(double(I));
      tmp = reshape(tmp,1,size(tmp,1)*size(tmp,2));
      C = [C;tmp];
end
