use of conditional statement
1 次查看(过去 30 天)
显示 更早的评论
I have a normalized image of size 160*190.i have to decompose it to low,middle and high inetnsity.the low bound is 0.4 and high bound is 0.7.which conditional statement can give the correct ans.
0 个评论
采纳的回答
Jos (10584)
2014-2-7
Here is an example to obtain low intensities. It is often handy to keep the original format and set the elements you are not interested in to NaN or some other arbitrary value.
AllImage = rand(6,5) % smaller example
tf = AllImage < 0.4
lowImage = nan(size(AllImage))
lowImage(tf) = AllImage(tf)
ValuesOnly = AllImage(tf)
更多回答(1 个)
David Sanchez
2014-2-7
if (x<0.4)
...do anything
elseif (x>=0.4 | x<=0.7)
...do another thing
else % this is for x>0.7
...whatever
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!