MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

end
end


There are two exceptions in the cause field of ME3:


ME3.cause
ans =
[1x1 MException]
[1x1 MException]


Examine the cause field of ME3 to see the related errors:


ME3.cause{:}
ans =


MException object with properties:


identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or method 'D' for input
arguments of type 'double'.'
stack: [0x1 struct]
cause: {}
ans =


MException object with properties:


identifier: 'MATLAB:load:couldNotReadFile'
message: 'Unable to read file test204: No such file or
directory.'
stack: [0x1 struct]
cause: {}


The Correction


Some exceptions may have a fix that can be suggested when the exception occurs. If you
are throwing an exception, you can suggest a fix by creating a
matlab.lang.correction.AppendArgumentsCorrection object and adding it to the
Correction field of the exception.


You must use the following syntax when adding a fix to the Correction field:


primaryException = addCorrection(baseException,exceptionCorrection)


Capture Information About Exceptions
Free download pdf