Main Content

When MATLAB Terminates Unexpectedly

If MATLAB® detects an internal error, then MATLAB displays one of two dialog boxes: MathWorks® Crash Reporter or MathWorks Crash Analyzer. In both cases, the internal state of MATLAB is unreliable and not suitable for further use. If these dialog boxes do not appear, then you can locate and send crash files manually.

MathWorks Crash Reporter

If MATLAB crashes, the MathWorks Crash Reporter dialog box appears and prompts you to send the crash report to MathWorks technical support. You can optionally provide reproduction steps or describe what you were doing at the time of the crash. If you click Send Report and provide a valid email address, you will receive an automated email shortly. If you want help with your crash, reply to the email and a technical support agent will contact you. If you do not receive an email, you can contact MathWorks technical support directly on the MathWorks Contact Support page.

The Crash Reporter displays information relevant for diagnosing the cause of the problem, which varies depending on what caused MATLAB to crash. If you know the cause of the crash, then you can check for information about it in the MathWorks Bug Reports database.

MathWorks Crash Analyzer

If MATLAB terminates unexpectedly, MATLAB locally analyzes the crash report on your machine to determine a potential cause. If there is a potential solution, MATLAB displays the MathWorks Crash Analyzer dialog box. Click View Solution to open a webpage in your browser that points to the relevant MATLAB Answers™ page or MathWorks Bug Reports database. To apply a fix, you must restart MATLAB.

If the provided solution is not relevant, then click Send Report and enter reproduction steps in the window.

If you apply the fix and still experience a crash, then click Send Report or create a support case by contacting MathWorks technical support on the MathWorks Contact Support page.

Send Crash Files Manually

In some situations, the Crash Reporter does not open. For example, the Crash Reporter is unavailable if you start MATLAB with the -nodisplay option. Depending on how MATLAB crashes, it generates either a text crash report or a minidump crash report. It also might generate additional log files. You can email the crash report and log files to MathWorks technical support.

Locate Crash Log Files

When MATLAB crashes, it may generate up to three log files with these names:

  • matlab_crash_dump.processID

  • java.log.processID

  • hs_error_pidprocessID.log

In these filenames, processID represents a four-digit process ID. For example, you might see crash dumps named matlab_crash_dump.3944, java.log.3944, and hs_error_pid3944.log. The location of the crash log files depends on your operating system. You can navigate to them using the MATLAB Command Window or using your operating system.

You can locate the crash log files directly from the MATLAB Command Window using the following code. This code returns the table files, which contains your crash logs. Use the date column to determine which crash logs are relevant to your crash.

prefixes = ["matlab_crash_dump"; "java.log"; "hs_err"];
files = struct;

log_dir = "~";
if ispc
    log_dir = tempdir;
end

for i = 1:length(prefixes)
    log_pattern = fullfile(log_dir,prefixes(i)+"*");
    if ~isempty(dir(log_pattern))
        files = struct2table(dir(log_pattern));
        files = sortrows(files,"datenum","descend")
    end
end

You can also manually search your operating system for crash log files using these methods.

Platform

System Navigation

Windows®

On Windows platforms, crash log files are located in the folder where the operating system stores temporary files. To open your temp folder, enter this text into the search field in the taskbar, Start menu, or File Explorer:

%temp%
Alternatively, you can manually navigate to this folder:
C:\Users\%username%\AppData\Local\Temp

macOS

On macOS platforms, crash log files are saved to your home folder. From the Finder menu bar, select Go > Home to open your home folder. Alternatively, from the terminal, enter cd ~ or cd $HOME to navigate to your home folder.

Linux®

On Linux platforms, crash log files are saved to your home folder. From the terminal, enter cd ~ or cd $HOME to navigate to your home folder.

Locate Crash Report Folder

Since R2025a

If you cannot find the relevant crash log files in the locations listed in the previous section, you might have minidump files located in your crash_reports folder. Minidump filenames are universally unique identifiers (UUIDs), which are a long series of letters, numbers, and dashes, followed by the file extension .dmp. For example, you might see a minidump filename like ac60e913-886c-466b-ae99-bceef3c25f19.dmp. You can use the matlab.crashhandling.crashReportFolder function to locate your crash_reports folder, or you can manually navigate to it.

You can locate the crash report folder from the MATLAB Command Window using these commands.

Platform

Folder

Windows
cd(fullfile(matlab.crashhandling.crashReportFolder,"reports"))
macOS and Linux
cd(fullfile(matlab.crashhandling.crashReportFolder,"completed"))

You can return all of your minidumps using the following code. This code returns the table files, which contains your minidumps. Use the date column to determine which minidumps are relevant to your crash.

files = struct;

report_dir = "completed";
if ispc
    report_dir = "reports";
end

pattern = fullfile(matlab.crashhandling.crashReportFolder,report_dir,'*.dmp');
if ~isempty(dir(pattern))
    files = struct2table(dir(pattern));
    files = sortrows(files,"datenum","descend")
end

Alternatively, you can manually navigate to the crash_reports folder.

Platform

Folder

Windows%LOCALAPPDATA%\MathWorks\release-hash\crash_reports
macOS$HOME/Library/Application Support/MathWorks/release-hash/crash_reports
Linux$HOME/.MathWorks/release-hash/crash_reports

In these folder paths, release-hash represents an identifier that is unique to each MATLAB installation. So, you might find multiple folders containing crash dump files. To find the relevant crash dump, check each folder for a .dmp file with a timestamp around the time of the crash.

See Also

Topics