Main Content

Handle .NET Exceptions

MATLAB® catches exceptions thrown by .NET and converts them into a NET.NetException object, which is derived from the MException class. The default display of NetException contains the Message, Source and HelpLink fields of the System.Exception class that caused the exception. For example:

try
  NET.addAssembly('C:\Work\invalidfile.dll')
catch e
  e.message
  if(isa(e,'NET.NetException'))
    e.ExceptionObject
  end
end

See Also