Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Memory error on subsequent assignment
Date: Tue, 8 Jul 2008 04:01:05 +0000 (UTC)
Organization: Queensland Investment Corp
Lines: 18
Message-ID: <g4uoq1$20v$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1215489665 2079 172.30.248.37 (8 Jul 2008 04:01:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 8 Jul 2008 04:01:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1094261
Xref: news.mathworks.com comp.soft-sys.matlab:478073



I know most of the memory error issues (contiguous blocks
etc) but can't quite understand why it is I'm getting an out
of memory error on a particular line. I do the right thing
and pre-allocate the memory block using...

mth_ret = zeros(nsims, mths, ac, 'single');

but get the out of memory error in the subsequent loop that
performs variable assignment...

for j = 1:ac
    mth_ret(:,:,j) = <variable>.<field>.<var>(1:nsims,:);
end

I was wondering whether the error is caused by Matlab
manipulating the data for assignment or for some other reason?

Thanks.