% Process face datasets step = 4; cd 'yaleFacesB\yaleB05_P00' I = []; for i = 1:64 filename = ['yaleB05_P00A_' num2str(i) '.pgm']; [pic,maxgray]=getpgmraw(filename); I = [I reshape(pic(1:step:end,1:step:end),prod(size(pic))/step^2,1)]; end cd '..\yaleB08_P00' for i = 1:64 filename = ['yaleB08_P00A_' num2str(i) '.pgm']; [pic,maxgray]=getpgmraw(filename); I = [I reshape(pic(1:step:end,1:step:end),prod(size(pic))/step^2,1)]; end cd '..\yaleB10_P00' for i = 1:64 filename = ['yaleB10_P00A_' num2str(i) '.pgm']; [pic,maxgray]=getpgmraw(filename); I = [I reshape(pic(1:step:end,1:step:end),prod(size(pic))/step^2,1)]; end cd .. cd ..