evalWithTimer

Execute a command within the specified time-limit, or kill the process.
338 download
Aggiornato 13 set 2016

Visualizza la licenza

Running complicated tasks sometimes take huge amount of execution time in matlab. Supose you want to stop running a command, if it takes too much execution time, then this is the code for you. Using function 'evalWithTimer', you can spcify the command to execute (1st input), and maximum time-limit in seconds (2nd input). If the command execution takes more time than the specified time-limit, then this program automatically kills the process and returns a non-zero status value.

-EXAMPLES

1. Compute the square root of 123 within 100 seconds, and store it in variable 'a' in the workspace
status = evalWithTimer('a=sqrt(123)',100)

2. Solve a linear program with 'n' variables in 1 hour
n=10^5; A=rand(n)-0.5; b = rand(n,1)-0.5; f = rand(n,1)-0.5;
status = evalWithTimer('x = linprog(f,A,b)',3600)

Cita come

Anver Hisham (2025). evalWithTimer (https://it.mathworks.com/matlabcentral/fileexchange/59120-evalwithtimer), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2015b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Get Started with MATLAB in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0