How to avoid MATLAB crash when opening too many figures?

后端 未结 3 1491
野趣味
野趣味 2020-12-16 14:28

Sometimes I start a MATLAB script and realize too late that it is going to output way too many figures. Eventually I get an

Exception in thread \"AWT

3条回答
  •  借酒劲吻你
    2020-12-16 14:53

    I use the findobj function in my own function 'limfig', where imglimit sets the amount of figures you want to be allowed to open at one time.

    function y=limfig
    imglimit=15;
    if length(findobj('type','figure'))

    Save this short code as limfig.m and then in any other code use the line f=limfig instead of f=figure.

提交回复
热议问题