필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how can i debug this script file?

조회 수: 2 (최근 30일)
Tony Yang
Tony Yang 2020년 8월 29일
마감: MATLAB Answer Bot 2021년 8월 20일
i dont know whats the issue of this.
  댓글 수: 1
madhan ravi
madhan ravi 2020년 8월 29일
Attach your script file instead of screenshots.

답변 (1개)

Sourabh Kondapaka
Sourabh Kondapaka 2020년 9월 2일
Hi,
In your “PixelIsBlue.m” file, the syntax for declaring the function is wrong. Functions, if at all they return something, it’s a variable.
Based on your second screenshot where you are checking if a pixel is blue or not in the “if” condition from line 46 to 48.
You intended to return a variable but within the function you are just displaying true or false.
Modify your “PixelIsBlue.m” file with below approach and the rest of your code should work well with “PixelIsBlue.m” file.
function result = PixelIsBlue(r,g,b)
if r < 128 && b >= 128 && g < 128
result = true;
else
result = false;
end
If you would like to just display the whether the pixel is blue or not without returning anything, please refer to the below code:
This is just showing an alternative approach and will not work with the existing implementation with other files:
function PixelIsBlue(r,g,b)
if r < 128 && b >= 128 && g < 128
disp("true");
else
disp("false");
end
To learn more about MATLAB programming language or about functions in MATLAB, you can visit this link.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by