??? Out of memory. Type HELP MEMORY for your options.
when MATLAB says it’s out of memory, it means it’s out of contiguous memory, so rebooting or restarting MATLAB may work.
A wide range of problems can cause out of memory errors.
To diagnose, use “dbstop if all error” to set a breakpoint on errors. The out of memory will trigger this, and you can use dbup, dbdown, and whos() to see what’s consuming memory.
Often an Out Of Memory is caused by a bad array size or index calculation, not just by big data structures.