Terminate an application called by system() after fixed amount of time
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kevin Aghaei
am 15 Jun. 2017
Kommentiert: Sajid Afaque
am 18 Dez. 2019
Hello,
I have an application that interfaces with a third party software and receives UDP datagrams in real time. The application, when opened, stays open indefinitely and does not terminate. I want to read the output of the program and save numerical data to the MatLab workspace in real time.
The only way I can think of doing this is to open and close the application iteratively in a loop, saving the output (which prints in the command window) using diary, then reading the output with another script that pulls out the numerical values I want and save them in MatLab.
The issue I'm having is that the application does not terminate on its own. It stays open indefinitely and does not accept and user input. When run in MatLab using system(), it stays open until I break it using Control+C. How do I implement code in MatLab to terminate an application that is currently occupying the command window?
The furthest I got in the past few days of research has been to use the parallel computing toolbox, and use parfeval to asynchronously insert some kind of break after running a separate timer function inside of a loop under parfor.
I'm by no means an expert MatLab user but there has to be a way to make an application time out or stop in MatLab after it begins running, without using control+C.
Here is the application that I am trying to call and close on a time basis in MatLab:
0 Kommentare
Akzeptierte Antwort
Nagarjuna Manchineni
am 20 Jun. 2017
See the following link that discusses on how to create and kill the process after some time:
In addition to the above implementation, you can use the 'timer' function to create a timer object that executes the desired functionality after a certain time (mentioned while creating the timer object). You can use that to kill the spawned process if it still running after your desired time.
See the following documentation link for more information on timer class:
1 Kommentar
Sajid Afaque
am 18 Dez. 2019
But what if i only have to wait and kill only for some iteration ?
i dont want to wait so long for all the iteration.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!