How to add delay selectively?

4 views (last 30 days)
Dong Hyeon Noh
Dong Hyeon Noh on 18 Dec 2015
Commented: Rebecca Krosnick on 22 Dec 2015
Hi I'm very new to Matlab. I wanna add delay on just one if command among 3 if states. Those 3 if commands are all in while state. So when I put pause function, all while function is got delayed. Can I just delay specific if commands among them, without delaying whole while sentences? Sorry that I'm not good at English! Please help me!
  1 Comment
Rebecca Krosnick
Rebecca Krosnick on 22 Dec 2015
Does your code look something like this?
while condition1
if condition2
pause(5); % pause 5 seconds
end
if condition3
end
if condition4
end
end
If your program is written this way, then when it reaches the "if condition2" line, if condition 2 is true, then your program will pause and wait 5 seconds until it proceeds to the next if statement ("if condition3"). Is this the behavior you would like? If not, can you give an example of the behavior you do want?

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!