Unload matrix and free memory

前端 未结 3 1135
悲&欢浪女
悲&欢浪女 2021-01-14 10:14

I can load a matrix from text file:

load mydata.txt

The problem is my matrix file is about 250Mb and after several such loads I have no mem

相关标签:
3条回答
  • 2021-01-14 10:44

    Use clear, or clearvars. By default, MATLAB will create a variable called mydata as a result of your statement, so

    clear mydata
    
    0 讨论(0)
  • 2021-01-14 10:47

    What you have to do clear mydata and then issue pack . The first command says to Matlab that the reference to the memory held for mydata is not needed anymore. The second command instruct the Matlab to free unused memory. If you don't issue pack, then memory will be deallocated when the Matlab memory manager decides to.

    0 讨论(0)
  • 2021-01-14 10:48

    Find the variables in your workspace that contain the large data sets and in your script or from the console type

    clear whateverVariableName
    

    To clear all memory use

    clear all
    

    You can even right-click individual variables in he workspace editor and delete them using the IDE if you wish.

    0 讨论(0)
提交回复
热议问题