Restoring MATLAB Command Prompt after a mex file crashes.

조회 수: 1 (최근 30일)
Aaron  Wetzler
Aaron Wetzler 2011년 1월 27일
댓글: Alec Jacobson 2015년 8월 20일
Can't seem to find an answer to this one. I am writing a mex file and testing it in the command window. Sometimes I have bugs that cause the program to crash and the MATLAB command window then tells me I have to restart MATLAB but that seems silly because nothing in MATLAB actually stops working. so what bothers me about this is that I can't restore the command prompt to
>>
It just stays at
[Please exit and restart MATLAB]>>
Anyone know how to avoid this or stop MATLAB from crashing together with my program?

채택된 답변

Jan
Jan 2011년 1월 28일
Yair Altman's setPrompt can change the prompt:
But I'd strongly suggest to follow Matlab's estimation that a restart of Matlab is necessary. The effects of a confused memory management are impossible to predict and can destroy data: "delete(gcf)" can delete a file, if the reply of "gcf" is mapped to a string instead of a figure handle...
  댓글 수: 1
Alec Jacobson
Alec Jacobson 2015년 8월 20일
This unfortunately just replaces all of the characters with spaces.

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 1월 27일
My speculation is that you are messing up one of Matlab's internal data structures and it is detecting that. It might look like Matlab is still working fine, but Matlab knows that it is sick.
mex is not a "sandbox": things you do in mex can mess up Matlab badly.
I gather that if you are going to work with mex, this is something you just have to get accustomed to until you are more proficient.
  댓글 수: 2
Aaron  Wetzler
Aaron Wetzler 2011년 2월 1일
The point about matlab not being a sandbox is a good one. Which leads me to another question: How does one correctly and efficiently go about writing, compiling and testing mex files in matlab?
Jan
Jan 2011년 2월 1일
Move this important question into a new question (!) instead of an comment of an answer.

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

카테고리

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