Here is the office site describing how to use memory efficiently with Matlab.
One common pit is the following:
>> a=rand(100e6,1);
The above command will generate vector a; now if you want to generate another set of random numbers and store in a, you may think you just type in:
>> a = rand(100e6, 1)
This will not work!!!
You need to do the following:
>> a = rand(100e6, 1);
>> clear;
>> a= rand(100e6, 1);
This way, basically you clear out the old variable "a" first, then you generate a new one and store it in a. Basically the biggest memory to use to allocate the variable is half of your memory in this case.
9/11/09
Matlab memory management.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment