Killing a (mex) Function When It Doesn't Respond to Ctrl-C or Ctrl-Break Under WIN64
이전 댓글 표시
Is there a way to kill a (mex) function running in MATLAB and which doesn't respond to Ctrl-C or CTrl-Break, other than by killing the whole MATLAB process (session)? To be concrete, assume R2014A WIN 64.
Thanks.
채택된 답변
추가 답변 (2개)
Peter Lawrence
2017년 10월 6일
편집: Walter Roberson
2017년 10월 6일
4 개 추천
Yes, it's part of the "undocumented" matlab stuff, but at least it works, and works well.
and/or
Victor
2016년 6월 16일
0 개 추천
Who accepted that unacceptable answer!?
No but seriously this is sooooooooooooooooooooooooooooooooooooooooo annoying!
댓글 수: 4
Walter Roberson
2016년 6월 16일
If my memory serves me correctly, I am the person who marked the answer as Accepted. Jan's response was a correct response to what was asked, about whether there was a way to do something. Neither Jan nor the rest of us can force MATLAB to do things it is not designed for. We might not always like what happens with MATLAB, but a correct answer deserves to be Accepted.
Bryan Cunitz
2019년 2월 8일
I disagree. I think the accepted answer should be changed since the "undocumented" solution is the best answer since it IS possible. If Mathworks wants to promote the answers forum then it should encourage undocumented solutions otherwise people will just move towards other forums.
just my 2 cents
James Tursa
2019년 2월 8일
편집: James Tursa
2019년 2월 8일
Huh? OP asked about a mex function that specifically does NOT respond to Ctrl-C or the like. He makes that very clear in his response to Peter that he is interested in interrupting compiled mex routines that have no special coding to respond to Ctrl-C. Jan's answer is correct for the question asked.
Peter's response is definitely valuable and related to the question, but it requires recoding and recompiling the mex routine, something the OP specifically points out was not the intent of his original question. Plus, it is not clear to me what would happen in that 2nd link if the MATLAB Memory Manager was interrupted in the middle of something when its Worker Thread got terminated. I haven't inestigated this, but I can easily envision a crash scenario.
Both responses deservedly got reputation points. I don't think there is anything to complain about here ...
Pavel Holoborodko
2020년 1월 23일
@"Plus, it is not clear to me what would happen in that 2nd link if the MATLAB Memory Manager was interrupted in the middle of something when its Worker Thread got terminated."
Suggestions to the situation are provided in the post. In short, WorkerThread must be used for computations, not for memory allocations (especially not by MATLAB Memory Manager functions). It is really bad idea to mix allocations & computations in (any) numerical code anyway.
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!