Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Matlab memory manage help!!

Subject: Matlab memory manage help!!

From: Dany

Date: 14 Jun, 2010 03:58:03

Message: 1 of 3

Hi, My matlab program tend to eat the memory, I have used a cluster with 32G Memory and multi processor and still having problems, My question is abt the best way to manage memory, basically I know it depends on what the program do and the system being used. Here is the case, the program generates a huge matrix and do some calculations on each row recursively. My 1st Question is , does matlab alway loads the whole matrix to the memory even if the other values are not needed all the time? if so, is there a way to load only the values needed in a time and then clears those being used earlier and how to do that. The 2nd Question is after each calculation I need to save values incrementally in file , they don't need to still in memory. The last Question is if I am able to do that does it slow the execution of the simulation.

Subject: Matlab memory manage help!!

From: Rob Campbell

Date: 16 Jun, 2010 14:58:04

Message: 2 of 3

> My 1st Question is , does matlab alway loads the whole matrix to the memory even
>the other values are not needed all the time?
Yes

>if so, is there a way to load only the values needed in a time and then clears those
>being used earlier and how to do that.
Save your matrix one row at a time. eg
save MAT row1 row2 row3
clear all
load MAT row1


>The 2nd Question is after each calculation I need to save values incrementally in file ,
>they don't need to still in memory.
?

>The last Question is if I am able to do that does it slow the execution of the simulation.
If you do it right then it should make too much difference, but it will depend on the simulation.

Subject: Matlab memory manage help!!

From: us

Date: 16 Jun, 2010 15:05:20

Message: 3 of 3

"Dany " <rodytc@yahoo.com> wrote in message <hv49cb$l86$1@fred.mathworks.com>...
> Hi, My matlab program tend to eat the memory, I have used a cluster with 32G Memory and multi processor and still having problems, My question is abt the best way to manage memory, basically I know it depends on what the program do and the system being used. Here is the case, the program generates a huge matrix and do some calculations on each row recursively. My 1st Question is , does matlab alway loads the whole matrix to the memory even if the other values are not needed all the time? if so, is there a way to load only the values needed in a time and then clears those being used earlier and how to do that. The 2nd Question is after each calculation I need to save values incrementally in file , they don't need to still in memory. The last Question is if I am able to do that does it slow the execution of the simulation.

a hint:
- answers to all of your questions are found by perusing...

     doc save;
     doc load;
% with their various options/syntax

us

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us