srcFiles = dir('C:\Users\Delna_Jose\Documents\MATLAB\database\*.png'); % the folder in which ur images exists
for i = 1 : length(srcFiles) filename = strcat('C:\Users\Delna_Jose\Documents\MATLAB\database\',srcFiles(i).name); A = imread(filename); k1=size(A) A1=imresize(A,[28 28]) B=char(A1) k2=size(B) k3=(reshape(B,1,2352)') t0(:,i)=k3 k4=size(t0) % figure, imshow(A);
end t0v=t0(:,1:5) t0w=t0(:,6:10) t0x=t0(:,11:15) t0y=t0(:,16:20) t0z=t0(:,21:25) EUCLEDIAN-METHOD====================================Dim_Red= 24;%Number of dimension
Accu=[];Error=[];A=[];%Dimensionality reduction using PCA
[Vecs(:,:,1),Mean(:,1),Projec0] = abn_pca(t0v,Dim_Red); [Vecs(:,:,2),Mean(:,2),Projec1] = abn_pca(t0w,Dim_Red); [Vecs(:,:,3),Mean(:,3),Projec2] = abn_pca(t0x,Dim_Red); [Vecs(:,:,4),Mean(:,4),Projec3] = abn_pca(t0y,Dim_Red); [Vecs(:,:,5),Mean(:,5),Projec4] = abn_pca(t0z,Dim_Red); %[Vecs(:,:,6),Mean(:,6),Projec5] = abn_pca(t55,Dim_Red);
%[Vecs(:,:,7),Mean(:,7),Projec6] = abn_pca(t66,Dim_Red);
%[Vecs(:,:,8),Mean(:,8),Projec7] = abn_pca(t77,Dim_Red);
%[Vecs(:,:,9),Mean(:,9),Projec8] = abn_pca(t88,Dim_Red);
%[Vecs(:,:,10),Mean(:,10),Projec9] = abn_pca(t99,Dim_Red);
%%%**********************************************************************
%%%..........FUNCTIONAL IMPLEMENTATION OF PCA FOR K-NN & EUCLEDIAN........
%%%**********************************************************************function [base,mean,projX] = abn_pca(Xd,k) [xdim,N] = size(Xd); mean = sum(Xd,2)/N; Xd = Xd-repmat(mean,1,N);cov = Xd*Xd'/N; [ev,ed]=eig(cov); ed = diag(ed); [foo,p]=sort(-ed); ed = ed(p); ev = ev(:,p); base = ev(:,1:k); projX = base'*Xd; %%========================================================================
%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.....END.....$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%%========================================================================
THE ERROR FOUND IS
Error: File: final.m Line: 82 Column: 1Function definitions are not permitted in this context.
Best Answer