Kill script from outside script

조회 수: 1 (최근 30일)
Jnior
Jnior 2012년 7월 26일
Hi all
I have the following problem. I start a Matlab exe-file (from matlab compiler), which creates a place holder function. That function then waits for input and when it gets it, it starts a script inside it. The reason I do it this way is that it takes a long time to start matlab before the actual execution can start if I don't, and I want the script to run as soon as the input arrives. Now, I want to be able to stop the "inner" script without killing the place holder function. Can I do that, and in that case, how?
I can't litter the code with error conditions because I might want to kill the process when it's doing a long loop in a function I don't have access to.
If that's not possible, is there any other way of speeding up the startup in matlab compiler .exe files?

답변 (1개)

Sumit Tandon
Sumit Tandon 2012년 7월 26일
Have you considered using a combination of flags (being set by external inputs) and break/continue statements?
Before starting the EXE created using MATLAB Compiler, MCR needs to be started in the background. MCR is a head-less version of MATLAB. The start-up time for MCR is going to be similar to MATLAB.
  댓글 수: 2
Jnior
Jnior 2012년 7월 26일
Thank you for the quick answer.
Yes, I have considered flags, the problem is that many time consuming parts of the code is made inside code that I haven't written, and while I could technically create a copy of the entire matlab library with little edits, it seems a bit... Inelegant. There's also quite a lot of code, some of which I have not written myself and it would be a hassle to go through everything to fix all the places that might take time.
Is there any other way to open the MCR before the actual execution starts in a way that doesn't require it to open again every time you want to use it?
Sumit Tandon
Sumit Tandon 2012년 7월 26일
Unfortunately there is no way to start the MCR before the EXE - since its "in-process" MCR. You cannot start the MCR as a background process and then start the EXE. You will need to start the EXE (together with MCR) and then wait for the input to come, just like you are doing now.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by