Fmincon + Interior point algorithm + Memory problems---How to fix this problem please>
1 view (last 30 days)
Show older comments
Dear All,
I keep receiving this error message when implementing an optimization with fmincon (interior point algorithm). I seems that it is a memory problem, any clue of how to fix this one please?
??? Error using ==> ldl Out of memory. Type HELP MEMORY for your options.
Here is my code:
beq = [ 1 const1 const2]' ;
months={'Jan', 'Feb', ...,'Dec'};
for i=1997
for j=1:length(months)
w0=xlsread(P:\excelfile.xls ,'Begin','S5:S5000');
a1=xlsread(['P:\excelfile.xls,'Begin','H5:H5000');
a2=xlsread(['P:\excel file.xls'],'Begin','Z5:Z5000');
a = [a1, a2];
n = size(a,1) ;
Aeq = vertcat(ones(1,n),a') ;
lb = zeros(n,1) ;
H = eye(n) ;
[w,fval, exitflag] = fmincon(@(x)norm(H*x-w0)^2,w0,[],[],Aeq,beq,lb,[],[],options);
end
end
Any guidance or advice is much appreciated. Regards
Saad
5 Comments
Walter Roberson
on 5 Dec 2012
Where in the code is the data file changing?
The code you posted is broken for the first two xlsread() calls, as the filename lacks all quotation marks in the first one and it lacks the closing quotation mark and closing ] in the second call. Please post accurate code as the solution might happen to be in something subtle.
Answers (2)
Walter Roberson
on 5 Dec 2012
People have encountered memory problems when using xlsread() for many files in the same session. I do not know if the problem has been tracked down. If you are using MS Windows then more efficient and less of a memory problem is to open Excel through ActiveX and then to control it to do the reading.
Your code could also run out of memory if the files were sufficiently big.
In the case where an input file does not exist, your code repeats the previous optimization.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!