How can I programmatically extract the line number at which a caught error occurred?
7 views (last 30 days)
Show older comments
MathWorks Support Team
on 14 Nov 2019
Answered: MathWorks Support Team
on 14 Nov 2019
How can I programmatically extract the line number at which a caught error occurred?
Accepted Answer
MathWorks Support Team
on 14 Nov 2019
The line number at which a caught error occurred is stored in the MException object. For example, the error number is being extracted from the "mErr" MException object. in the following code:
try
surf
catch mErr
error_line = mErr.stack(end).line;
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Exception Handling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!