Combined Slip Wheel STI: Cannot determine the exact number of iterations for a loop with range

5 ビュー (過去 30 日間)
Brandyn Pataki
Brandyn Pataki 2023 年 10 月 20 日
回答済み: Shubham 2023 年 12 月 3 日
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! :)

回答 (1 件)

Shubham
Shubham 2023 年 12 月 3 日
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!!

カテゴリ

Help Center および File ExchangeModel Verification についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by