Custom error message for exceptions

This is the situation:
I want to throw an MException with a custom message, lets say:
if(0 == this.Model.NumInputs)
err = MException('jku.methods:InvalidModel', 'Invalid Tree. The prune of the tree gives an empty tree!');
throw(err);
end
How can I define that message identifier 'jku.methods:InvalidModel' ??? I am getting the error
??? Error using ==> MException IDENTIFIER input must be a valid MATLAB message identifier. For more information, search for "message identifier" in the MATLAB Help.
Thanks !!

답변 (1개)

Walter Roberson
Walter Roberson 2012년 2월 9일

1 개 추천

The part before the ':' cannot contain a period.

댓글 수: 1

Kaustubha Govind
Kaustubha Govind 2012년 2월 9일
Also, for more information: http://www.mathworks.com/help/releases/R2011b/techdoc/matlab_prog/bq9l448-1.html#bq9tdlq-1

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

카테고리

도움말 센터File Exchange에서 Programming Utilities에 대해 자세히 알아보기

제품

질문:

2012년 2월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by