System command and pop up windows

조회 수: 2 (최근 30일)
Umberto
Umberto 2017년 2월 1일
답변: Steven Lord 2017년 2월 3일
I need to run compiled C code from Matlab using a system command:
flag = system('code_to_run');
The flag is nonzero when the code fails.
My problem is that when the code fails Windows opens two pop-up windows.
One says "code_to_run has stopped working. Windows is collecting more information about the problem. This might take several minutes...".
The second window says "Do you want to send more information about the problem?".
Now, the flag is correctly assigned to a non-zero value (due to failure in the code) only after the user clicks CANCEL.
Is there a command to add in front of the system command
system(' ... maybe add something here ... code_to_run');
in order to systematically avoid opening these pop-up windows that require the user to click "cancel"?. This is because the code needs to be called from an iterative algorithm, and some iterations will involve inputs that return a successful flag, other inputs will lead to a failure flag.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2017년 2월 3일
Umberto - it sounds like your compiled C program is crashing (for some input data) so it may be a good idea to determine what the crash is and fix it. I think that it would be easier to fix the code rather than trying to suppress Windows dialogs (which are a result of the crash).

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

채택된 답변

Steven Lord
Steven Lord 2017년 2월 3일
Even if you could suppress those dialogs Windows brings up, in my opinion the right solution is to fix the bug that's causing the application to crash in the first place.
Debug your MATLAB application that calls the compiled application to identify the inputs with which MATLAB call the compiled application that cause it to crash, then investigate what the source code for the compiled application does with those inputs.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call MATLAB from C에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by