MATLAB Answers

MatLab crashing while saving variable

10 views (last 30 days)
Marc Laub
Marc Laub on 3 Jul 2020
Commented: Marc Laub on 8 Jul 2020 at 14:09
I am facing issues saving variables from my workspace. MatLab always crashes when I try to save handle objects.
When I test it with less objects it works all fine, but when I try it with my desired number it just crashes.
I dont expect the size of the reuslting mat file to exceed 2GB, however i set -v7.3 as default in my preferences for saving manualy by right clicking "save as", but I also tried it within the code as
Both didnt help and it just crashed.
I uploaded a file where u can see the structure if my objects, in this case there are 2000 objects, filesize is 246KB, I also can save 40k objects, filesize is now 150MB, but my desired value of 160k objects cant be done...
I use Win 10 64bit as OS and MatLab 2019b
Does anybody has an idea how i can save these many objects so i can use same as input and dont have to recalculate them everytime?
Many thanks in advance
Best regards


Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 3 Jul 2020
When it crashed, did it offer to send in the crash log, either when it crashed or when you started MATLAB the next time? If so, do that and someone will contact you. Otherwise if it's repeatable, you can call tech support and they will help you. See the FAQ entry: FAQ After installation MATLAB crashes or gives an error message when I try to run MATLAB


Show 2 older comments
Marc Laub
Marc Laub on 8 Jul 2020 at 12:16
The problem was that i had many object that are linked together and matlab tries to save one og these objects which ahs pointer to 5 or so other objects and ech of them has pointers to more objects. matlab tries to serealize those objects. Since all my objects are interconnected matlab simply cant handle it to save recursive defined objects in such a large number. my nuber of serialized pointers just exceeded the depth of matlabs recursive save ability.
I just have to save it in another way, like a adjacend matrix like its done in the graph function
Image Analyst
Image Analyst on 8 Jul 2020 at 13:34
Well they should be able to handle that with just a regular error message, like spew out red text to the command window rather than crashing MATLAB completely, like with a "MATLAB has encountered an error and needs to close" like it would say in Windows. Is that what you got? Which happened:
  1. A crash where you had to close MATLAB or it closed itself, or
  2. was it just a regular error with red text in the command window that stopped your program only, but MATLAB itself continues to run.
Which case was it?
If it's case 1, then that shouldn't happen and the Mathworks would want to know about it.
If it's case 2, then that's just an error in your program (like your recursion went too deep or whatever), then that's for you to solve.
Marc Laub
Marc Laub on 8 Jul 2020 at 14:09
First case. MatLab closed itself without any message or report at all.
I guess they now know about that error because the tech support told me what causes the crashing.

Sign in to comment.




Translated by