Execute code if m-file runs into error

조회 수: 7 (최근 30일)
Yoeri
Yoeri 2013년 10월 23일
댓글: ES 2013년 10월 24일
I have tried finding the answer to this problem, but only got 'old' results which did not pose a solution. Maybe by now there is one.
I am controlling a combustion process using an m-file, which occasionally runs into errors (mostly scripting errors and typos). Having an error while the combustion is unstable, for example, is quite dangerous, so I want Matlab to execute a few lines of code whenever the m-file runs into an error. This is just simply closing the gas valve and turning the fan on.
Is there any solution for this? The problem is that most errors are scripting errors, which don't just give an error but also stop the mfile running...
Thanks!

채택된 답변

ES
ES 2013년 10월 23일
use try and catch at all suspect instances. This will solve your case.
But when you call a blob a script, it should not have scripting errors or typos;)
  댓글 수: 2
Yoeri
Yoeri 2013년 10월 23일
What do you mean with a blob? I'm currently developing algorithms for measurements, generally 2k lines, so a typo is not very strange imho.
I'll try the 'try and catch' commands.
ES
ES 2013년 10월 24일
blob means text. If some text qualifies to be called script or code, it should atleast be free of typhos and such errors. Did not mean to hurt you:)

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by