필터 지우기
필터 지우기

simulink error Variable 'img_r' is not fully defined on some execution paths.

조회 수: 1 (최근 30일)
tsai kai shung
tsai kai shung 2017년 10월 18일
댓글: Rik 2017년 10월 18일
function y = fcn(u,img1,img2, data)
Ne = u; L = img1; re = img2;
for n=1:Ne [r,c] = find(L==n); % Extract letter n1=re(min(r):max(r),min(c):max(c)); % Resize letter (same size of template) img_r=imresize(n1,[42 24]); end y = img_r;
why y is error?
  댓글 수: 2
Rik
Rik 2017년 10월 18일
Why do you think img_r would exist without defining it?
Rik
Rik 2017년 10월 18일
I seem to have misread. Selecting your code and pushing the {}Code button would help with making the code more readable.
You should copy the entire error message.

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

답변 (2개)

tsai kai shung
tsai kai shung 2017년 10월 18일
how to defining img_r i think take img_r to y so i don't need defining it.

tsai kai shung
tsai kai shung 2017년 10월 18일
function y = fcn(L,Ne,re)
for n=1:Ne
[r,c] = find(L==n);
% Extract letter
n1=re(min(r):max(r),min(c):max(c));
% Resize letter (same size of template)
img_r=imresize(n1,[42 24]);
end
y = img_r;
the error message is:Variable 'img_r' is not fully defined on some execution paths.
Function 'MATLAB Function1' (#487.229.234), line 9, column 5: "img_r" Launch diagnostic report.
  댓글 수: 1
Rik
Rik 2017년 10월 18일
You should answer in comments, not in answers. The answer section is for solutions to the problem, not for responses to clarification.
You should rethink what you want to do. This code seems to overwrite the result on every iteration. The error you are getting is strange, except if Ne is allowed to be 0.

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

카테고리

Help CenterFile Exchange에서 编程에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!