Sudden shutdown of MATLAB for no reason without error notification

162 views (last 30 days)
Hi community,
Currently I am experiencing an unexplainable matlab shutdown. Matlab fully shuts down half in the run of a relatively complex code without any error notification. I did perform the diary function to register all command window outputs, but no error message is recorded. It simply terminates in the middle of the code. There is no reason as far as I can see, no memory overflow, no infinite loops, no exit/break command of any sort. I tried it on two seperate computers with both Matlab R2019 and R2022.
I did create a function to record all data which enables me to continue the run from where it stopped, but this will be very time consuming and as MATLAB comes by license, I feel this kind of errors are not supposed to occur. Any advice is welcome.
Thank you
  1 Comment
Xin Niu
Xin Niu on 17 Apr 2024
Edited: Xin Niu on 17 Apr 2024
I have similar issue. The code used to run correctly and then crash without any reasons...
When I set break points and run it step by step in debug mode, it works. But it will crash (matlab exit without any error message) when I run it from beginning. This occurs on both R2023b (natively on M1) and R2023a (intel via rosetta) on Mac with M1 chip.

Sign in to comment.

Answers (1)

Dhruv
Dhruv on 31 Aug 2023
I understand that you’re experiencing MATLAB shutdowns while trying to run your code. Here are some steps you can take to try and identify the root cause of the issue:
  • Check System Resources: Make sure your system has sufficient resources (RAM, CPU, disk space) available to run MATLAB and your code. Running complex calculations can sometimes lead to resource exhaustion, causing MATLAB to crash without an explicit error message.
  • Memory Leaks: Even if there might not be any visible memory overflow errors, there can still be memory leaks in the code. MATLAB doesn't always catch memory leaks and they can gradually consume available memory, leading to unexpected crashes. Make sure that this is not contributing to the problem.
  • Event Logs: Check the computer's event logs for any system-level errors or warnings that coincide with MATLAB's shutdown. This might provide additional insights into the problem.
  • Code Optimization: If the code is running complex calculations, it might be worth optimizing it for better performance. Efficient algorithms and memory management can sometimes help prevent crashes.
I hope the above steps will help you to find the issue. By methodically testing and investigating different aspects of your setup and code, you can narrow down the potential causes and hopefully identify the root of the problem.
If the issue still persists, you can go ahead and create a Technical Support request for the same: https://www.mathworks.com/support/contact_us.html?s_tid=hc_trail

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!