필터 지우기
필터 지우기

why iam i getting the error the illegal use of the end?

조회 수: 2 (최근 30일)
uday
uday 2013년 7월 16일
댓글: Steven Lord 2019년 9월 9일
Q=imread('r6.jpg');
imginp=double(reshape(Q,64,1));
disp (' ');
disp ('Simulating SOM neural network for the input image...');
disp (' ');
msx=sim(net,imginp)
msxm=find(msx);
%classification and displaying output
disp (' ');
disp ('Classifying the subject in input image with the matched image in the training database...');
disp (' ');
ans=find((sm - msxm)==min(abs((sm-msxm))));
if (ans > 0) & (ans <= 5)
disp('Subject is identified to be: rock');
else if (ans > 5) & (ans <= 10)
disp('Subject is identified to be: hulk');
else if (ans > 10) & (ans <= 15)
disp('Subject is identified to be: bob');
else if (ans > 15) & (ans <= 20)
disp('Subject is identified to be: banda');
else
disp('Subject is not identified in the training database.');
end
end
end
end
when i try to execute it iam getting the following error y this is happening?
??? Error: File: C:\MATLAB7\work\trainsimsom.m Line: 63 Column: 1
Illegal use of reserved keyword "end".
  댓글 수: 3
the cyclist
the cyclist 2013년 7월 16일
Yes. And also use "elseif", not "else if".
uday
uday 2013년 7월 16일
yes yes thank you got it.......

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2013년 7월 16일
The correct syntax for an if statement is
>> if condition
>> <statements>
>> elseif condition2 % notice no space between else and if
>> <more statements>
>> end
You don't need multiple ends for the elseif statements.
  댓글 수: 2
uday
uday 2013년 7월 16일
thank u..in my code of face recognition the input image is to be taken from a digital camera of 2 megapixel(1600*1200)..but,after taking an image from the camera i have edited it and made to 1200*1200 only to concentrate on the face of the object..does it vary in a face recognition process
the cyclist
the cyclist 2013년 7월 16일
If this is another question, I don't understand what you are asking.
I suggest you open a new question and provide a little more detail.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Dokkuluri Gowtham
Dokkuluri Gowtham 2019년 9월 9일
Error: File: 29.m Line: 26 Column: 1
Illegal use of reserved keyword "end".
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 9월 9일
Is this referring to the code that was posted in the original question? If so then the cause is already described above: too many "end" statements.
Steven Lord
Steven Lord 2019년 9월 9일
If that's the error message exactly as MATLAB displayed it, I'm mildly surprised. MATLAB function names must start with a letter, not a number. I would have expected MATLAB to complain about that before trying to parse the file and noticing an extra end.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by