??? Index exceeds matrix dimensions...

am gettin an error in 33rd line-title('Looking for ...','FontWeight','bold','Fontsize',16,'color','red');..
can some1 help me
code:
w=load_database();
prompt={'compare'};
title='IMAGE INPUT';
ans=inputdlg(prompt,title);
if ~isempty(ans{1})
r1 = str2num(ans{1});
if isempty(r1)
ri =round (400*rand(1,1));
end
end
r=w(:,r1);
v=w(:,[1:r1-1 r1+1:end]);
N=20;
O=uint8(ones(1,size(v,2)));
m=uint8(mean(v,2));
vzm=v-uint8(single(m)*single(O));
L=single(vzm)'*single(vzm);
[V,D]=eig(L);
V=single(vzm)*V;
V=V(:,end:-1:end-(N-1));
cv=zeros(size(v,2),N);
for i=1:size(v,2);
cv(i,:)=single(vzm(:,i))'*V;
end
subplot(121);
imshow(reshape(r,112,92));
title('Looking for ...','FontWeight','bold','Fontsize',16,'color','red');
subplot(122);
p=r-m;
s=single(p)'*V;
z=[];
for i=1:size(v,2)
z=[z,norm(cv(i,:)-s,2)];
if(rem(i,20)==0),imshow(reshape(v(:,i),112,92)),end;
drawnow;
end
[a,i]=min(z);
subplot(122);
imshow(reshape(v(:,i),112,92));title('Found!','FontWeight','bold','Fontsize',16,'color','red');

4 件のコメント

kash
kash 2013 年 3 月 1 日
Edit the code before you post the code use {}button at the top for editing
Andreas Goser
Andreas Goser 2013 年 3 月 1 日
It is also likely that one needs the data too and not only the code to figure it out
Babak
Babak 2013 年 3 月 1 日
doesn't give me error when I ran it. I only ran that line which is correct. I don't know what is
w=load_database();
so can't run your script.
geethi
geethi 2013 年 3 月 2 日
You can find the database at the follwoing link, % http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2013 年 3 月 1 日

1 投票

Your line
title='IMAGE INPUT';
is making "title" into a variable, conflicting with your attempt to use title() as a function later.

4 件のコメント

geethi
geethi 2013 年 3 月 2 日
sir i tried to make both variables..but its not workin
Walter Roberson
Walter Roberson 2013 年 3 月 2 日
編集済み: Walter Roberson 2013 年 3 月 2 日
Change your lines
title='IMAGE INPUT';
ans=inputdlg(prompt,title);
if ~isempty(ans{1})
r1 = str2num(ans{1});
to
inputtitle='IMAGE INPUT';
userans=inputdlg(prompt,inputtitle);
if ~isempty(userans{1})
r1 = str2num(userans{1});
geethi
geethi 2013 年 3 月 20 日
the same error is coming
DGM
DGM 2022 年 12 月 11 日
If this is a plain script with no variable cleanup at the beginning, then the problem will persist until the variable called title is cleared.
clear title

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2013 年 3 月 1 日

コメント済み:

DGM
2022 年 12 月 11 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by