Combined Slip Wheel STI: Cannot determine the exact number of iterations for a loop with range
5 views (last 30 days)
Show older comments
Hello,
I was updating the unloaded radius (0.207) and rim radius (0.127) in the Combined Slip Wheel STI block and upon running got the following error.
What is confusing me is when I run a for loop with the range specified in the above error in a blank matlab script I do not get an error.
Thanks for the help! :)
0 Comments
Answers (1)
Shubham
on 3 Dec 2023
I understand that you are getting an error that Simulink is not able to determine the exact number of iterations in a loop with range.
Without the access of the actual code or model, it is difficult to reproduce or debug it. One of the possible reasons for such an error could be that the loop bounds are dynamic.
In MATLAB I tried out the following code snippet:
x =0.207;
y = 0.127;
for i= x:-0.001:y
y=y-0.01;
end
The code terminated with “i” having the value of 0.127 but the behaviour of such loops could be different in case of a Simulink model. Limit the maximum number of time steps in Simulink and identify if the loops are dynamic in nature.
Also refer to a previous case of MATLAB answer in which the Simulink model was not able to determine the number of iterations in the loop. The accepted answer suggests using step-sizes which are either integers or powers of 2 (e.g., ½). https://www.mathworks.com/matlabcentral/answers/47063-error-cannot-determine-number-of-iterations-for-a-loop
I hope this helps!!
0 Comments
See Also
Categories
Find more on Model Verification 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!