How to do if else condition?

Hello,
Anyone have idea how to do if else condition?
I have pixel value of AA(i,j)<507x507 double> and BB(i,j)<512x512 double>. I want to do if value of AA(i,j) and BB(i,j) exceed 15 (>15) it will return to "Th" if not it will return to "Offset".
>>(i,j) is row and column for pixel value of an image.
I hope u understand what i need since i am beginner in Matlab and image processing.

댓글 수: 4

Walter Roberson
Walter Roberson 2013년 5월 11일
What is "Th" ? What is "Offset" ?
Image Analyst
Image Analyst 2013년 5월 11일
편집: Image Analyst 2013년 5월 11일
Do you care that A and B are different sizes? What do you plan on doing when i and j are 508 to 512 and you can check only on B, not A?
See my image segmentation tutorial : http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. It's helpful to beginners.
troy
troy 2013년 5월 14일
편집: troy 2013년 5월 14일
actually i want to find threshold value and Th is Th(i,j). Same for Offset(i,j).
can I fix AA and BB, declare as:
AA(i,j)=(507:507); BB(i,j)=(507:507); like that?
thanks for the tutorial..
507:507 means the list of numbers starting from 507, incrementing by 1, until 507 is reached, and so would be equivalent to just 507 itself.
If you are trying to preallocate A, then
A = zeros(507, 507);

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

 채택된 답변

Walter Roberson
Walter Roberson 2013년 5월 11일

0 개 추천

if AA(i,j) > 15 & BB(i,j) > 15
... do something
else
... do something else
end

추가 답변 (0개)

태그

질문:

2013년 5월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by