Try to figure out your code follows same procedure as the one in this link https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&sqi=2&ved=0ahUKEwjUu_TY2_DRAhULgI8KHQO_B_oQFggZMAA&url=http%253A%252F%252Fwww.mathworks.in%252Fmatlabcentral%252Ffileexchange%252F45750-face-recognition-using-pca&usg=AFQjCNGSKpPVbSixxbJEhF8Yq-qwm2hpDQ&sig2=caGZtxJx2-39qXqk1Z3I0w&bvm=bv.146073913,d.c2I
And also PCA is not only algorithm for classification try out fishers linear discrimination and many more.