try/catch 構文で、エラーが発生した行番号を取得できますか?

5 visualizaciones (últimos 30 días)
MathWorks Support Team
MathWorks Support Team el 14 de Nov. de 2019
Respondida: MathWorks Support Team el 14 de Nov. de 2019
try/catch ステートメントを使っています。エラーが発生した行番号を取得する方法を教えてください。

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 14 de Nov. de 2019
try/catchステートメントで、エラーが発生した行番号を取得するには、MException オブジェクトにアクセスします。
例:
try
surf
catch ME
error_line = ME.stack(end).line % 行番号
end
以下の URLより関連ドキュメンテーションをご覧いただけます。
・MATLAB: 例外への応答

Más respuestas (0)

Categorías

Más información sobre Exception Handling en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos


Versión

R2013a

Community Treasure Hunt

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

Start Hunting!