Why does an if-structure exceed the given limit?
이전 댓글 표시
Hi,
I have a if-else-structure which exceeds the given limit, and I can't find out why. The code is:
recognition =0;
if recognition == 1
if weighted_timetable(quarter_of_the_day, activity_index, day_number) < 2
weighted_timetable(quarter_of_the_day, activity_index, day_number) = weighted_timetable(quarter_of_the_day, activity_index, day_number) + 0.1;
end
end
if recognition == 0
if weighted_timetable(quarter_of_the_day, activity_index, day_number) > 0.5
weighted_timetable(quarter_of_the_day, activity_index, day_number) = weighted_timetable(quarter_of_the_day, activity_index, day_number) - 0.1;
end
end
For recognition = 1, the code behaves as it should - it stops increasing the 3-D-Matrix at the given indexes when the value reaches 2. The problem lies in the second part: for recognition = 0, it decreases the value at the given indexes to 0.4, which means that it ignores the "> 0.5" limit, which I set.
After initializing all the needed variables, I ran only the code I posted with the "Evaluate Section" function to exclude any other factors, but the problem still persisted.
Thanks a lot for your help!
Cheers, Mathias
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Keypoint Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!