Display error message and execute catch
이전 댓글 표시
Hello, all. I've got a fairly simple question, and I can't seem to find the answer. If I have a try/catch block, I would like the error to be displayed in the Command Window but I would like to still execute the catch block. I know there are ways to use MException and getReport, but from what I have been reading it seems that you need to know which potential errors that will be thrown so you can use an if statement to print your error. Here is the theoretical snippet of code that I would want to execute:
try
% Here is a giant piece of code that can potentially
% throw hundreds of errors
catch
% If the above section threw an error, I want to display
% whatever that error was and continue the script here
end
How would I go about printing the error statement that kicked the script out of the try block? Thanks,
- Matt
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Exception Handling에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!