Printing MATLAB errors (R14sp3 and later)

Produces formatted output from the information returned by "lasterror"
Updated 1 Sep 2016

View License

Following the long-awaited addition to MATLAB of a mechanism for retrieving the call stack at the time of the last error it is now possible to find out where in the code the error occurred even when an error has been caught by a "catch" statement.
However, the convenient hyperlinks which allow you to go directly to the source of the error are only available when the error is uncaught.

This function prints similar hyperlinks in the MATLAB command window even for errors which were caught. Simply type "ple" at any time, and details of the the last error, including hyperlinks to every point in the call stack, will be shown in the command window.

Cite As

Malcolm Wood (2024). Printing MATLAB errors (R14sp3 and later) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Scope Variables and Generate Names in Help Center and MATLAB Answers

Inspired: SeisLab 2.01, SeisLab 3.01

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Updated license

Added copyright notice and suppressed an M-Lint warning.


Adding some keywords, since this entry doesn't appear when I search for "print error" or "print errors".