MATLAB: Do the Live Editor, Command Window, and Simulink get slow after several runs of a Live Script

livescriptMATLABperformance

Best Answer

This issue is likely due to MATLAB not having sufficient memory available to perform the calculations repeatedly.

You can increase the size of the Java Heap for MATLAB. The documentation for "Java Heap Memory Preferences" is here:

https://www.mathworks.com/help/releases/R2020a/matlab/matlab_external/java-heap-memory-preferences.html

You can also try removing 'clear' or 'close' commands in the Live Script, as these impact performance as well. For example, these functions:

>> clear all
>> close all

may cause performance issues if called repeatedly.

Related Question