Is the above MATLAB code syntax for temporarily pausing the simulation using if else statement, correct or wrong, if wrong then suggest the correct syntax ?
조회 수: 1 (최근 30일)
이전 댓글 표시
for i = 1:1:99
if (t == (0.05 * i))
pause(0.00001);
else
continue;
end
end
댓글 수: 1
Dyuman Joshi
2022년 6월 15일
편집: Dyuman Joshi
2022년 6월 15일
The syntax looks correct. Though, else part is redundant.
답변 (1개)
Sandeep
2023년 8월 30일
Hi Siddharth Kamila,
As far as syntax is concerned your code looks good but the continue statement is not necessary in this case.
To pause the simulation at specific time intervals, you can use the pause function with a specified time delay. Here's the corrected code:
for i = 1:1:99
if (t == 0.05 * i)
pause(0.00001);
end
end
Hope you find it helpful.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!