Why does an if-structure exceed the given limit?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Keypoint Detection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!