una_dinosauria
una_dinosauria

Reputation: 2051

Julia equivalent of Matlab's pause?

In Matlab, the function

pause(x)

Stops execution for x seconds. Is there something similar in Julia?

Upvotes: 21

Views: 15290

Answers (2)

Merlin
Merlin

Reputation: 1987

Not a serious answer, but I have a note-to-self from julia v0.4 days to use the following to pause execution for t seconds:

f = t -> watch_file(".",t)

Here's the current stable version documentation of watch_file.

I have another similar note suggesting this:

f = t -> (b=time(); while b+t > time() end)

I have no earthly idea why either would be preferred method of pausing program execution vs. sleep(x), perhaps someone could comment.

Upvotes: 0

lord.garbage
lord.garbage

Reputation: 5960

One method in julia is to use the sleep() function which takes the number of seconds as a parameter. The minimum number of time is 1 millisecond or an input of 0.001.

Upvotes: 28

Related Questions