Suppress external error message when using dos command

조회 수: 1 (최근 30일)
Jordy W
Jordy W 2018년 12월 14일
편집: Jordy W 2021년 4월 19일
Hello all,
I made an m-file which runs a lot of external executables through the dos command within a for loop as follows: [~,~]=dos(code);
Mostly this works perfectly. However, sometimes the external executable crashes and gives a Windows error as shown below. I don't really care about this error, I just want to close it and continue processing the m-file. Currently I have to manually close the error and then the m-file automatically continues, but I want to have the m-file run independently for multiple hours, so manual input is undesired. Is there anybody who can assist me with this question?
Thanks in advance for any help.
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 4월 16일
I wonder if you would be able to improve on the situation by using .NET System.Diagnostics.Process instead of calling dos() ? https://www.mathworks.com/matlabcentral/answers/575608-system-and-system-diagnostics-process#answer_485447
Jordy W
Jordy W 2021년 4월 19일
편집: Jordy W 2021년 4월 19일
Thanks for asking. Unfortunately, back then I wasn't able to actually suppress the error message. I think I changed the input to the executable so that it didn't crash. Which probably in general is a better solution, but that might not be viable in your situation.
Additionally, I changed the entire m-file (an application now) to Python, which I think is a bit more suited for running external executables.
Good luck!

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by