help-octave
[Top][All Lists]
Advanced

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

Command Timeout


From: Vote 539
Subject: Command Timeout
Date: Sat, 1 Jun 2013 03:04:54 -0500

Greetings,

Is there a way to limit the runtime of a command in Octave?  For example, consider the naive implementation of Fibonacci:

function y = fib(n)
    if(n<=1)
        y=1;
    else
        y=fib(n-1)+fib(n-2);
    end
end

On my machine, anything above fib(25) starts to take over a second to compute.  Is there a way to programmatically terminate a command after, say, 10 seconds?  Perhaps something similar to Linux timeout(1) ?

If nothing like this yet exists, where would it fit into the Octave source?

Thanks!

reply via email to

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