您的位置:首页 > 编程语言 > MATLAB

a little adjustment: clear sv ( MATLAB)

2017-02-06 17:11 85 查看
original:

        function draw_once(sv)

         

           draw_vehicle(sv);

           draw_sonic_line(sv);

          

                            

        end

new:

        function draw_once(sv)

         

           draw_vehicle(sv);

           draw_sonic_line(sv);

           clear sv;   %%%%%%%%%%%%%%%%%%%%%%%  after this added, memory will not increase in the for loop.

                            
        end

This test demonstrates that if you do not clear that memory, even after this function is finished, it will not automatically destroy sv to release this memory but keep it.

Very important and puzzling lesson!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: