Documentation Center

  • Trial Software
  • Product Updates

disp (MException)

Display MException object

Syntax

disp(exception)
disp(exception.property)

Description

disp(exception) displays all properties (fields) of MException object exception.

disp(exception.property) displays the specified property of MException object exception.

Examples

Using the surf command without input arguments throws an exception. Use disp to display the identifier, message, stack, and cause properties of the MException object:

try
   surf
catch exception
   disp(exception)
end

	MException object with properties:

    identifier: 'MATLAB:narginchk:notEnoughInputs'
       message: 'Not enough input arguments.'
         cause: {}
         stack: [1x1 struct]

Display only the stack property:

disp(exception.stack)
    file: 'C:\Program Files\MATLAB\toolbox\matlab\graph3d\surf.m'
graph3d\surf.m'
    name: 'surf'
    line: 54

See Also

| | | | | | | | | | | |

Was this topic helpful?