Combined Slip Wheel STI: Cannot determine the exact number of iterations for a loop with range
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1516096/image.png)
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 comentarios
Respuestas (1)
Shubham
el 3 de Dic. de 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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!