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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
for i = 1:1:99
if (t == (0.05 * i))
pause(0.00001);
else
continue;
end
end
1 Kommentar
Dyuman Joshi
am 15 Jun. 2022
Bearbeitet: Dyuman Joshi
am 15 Jun. 2022
The syntax looks correct. Though, else part is redundant.
Antworten (1)
Sandeep
am 30 Aug. 2023
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 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!