For loop in Simulink
이전 댓글 표시
Hi everyone,
I need to convert the following code to a SIMULINK model:
T = [2; 21; 22; 27; 27; 21; 18; 21; 26; 36];
for i = 1:10
C = T(i+1)/T(i);
end
I have used For Iterator Subsystem but I don't know how to apply the i variable to the model. The image of the model is attached herewith. Your help will be very much appreciated.
Mehdi

댓글 수: 1
Carsci
2015년 1월 19일
The question is lacking some boundary information for the case N=10. Specifically the calculation can be done for i = 1 : 9 or for i = 1 : 10. If N = 10 is required what is the value of T(i+1) to be used?
채택된 답변
추가 답변 (1개)
댓글 수: 1
Carsci
2015년 1월 27일
In the workspace you will also have the time dimension. You can try changing the simulation settings so Simulink only calculates one iteration or just decimate the matrix in matlab.
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
