help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically run a script every n seconds


From: Francesco Potortì
Subject: Re: Automatically run a script every n seconds
Date: Sun, 05 Apr 2020 14:46:33 +0200

>Is there a way to make Octave automatically run a particular script every n
>seconds, where n is user specified? The intent is to check a (financial)
>website every n seconds for a change in the data hosted on the website and
>then take some conditional action. I suppose I could write a while loop, but
>I was wondering if there is a dedicated Octave function/method for this.

The Octave interpreter is single-threaded (apart from plotting, which is
a different matter), so a loop is perfectly reasonable:

while true
  exec_your_code();
  if (terminate_condition)
    break;
  endif
  pause(n)
endwhile

Note that n can be fractional.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it



reply via email to

[Prev in Thread] Current Thread [Next in Thread]