Running out of memory in a not so big matrix
이전 댓글 표시
i wrote a program to extract data from various files and for some reason ~10% of them give me a "Maximum variable size allowed by the program is exceeded" error. The matrices in the ones that don't work aren't bigger than the ones that do work (less than a 500x10000 matrix). The code basically looks like this:
tempsave=zeros(c.trials,9900);
accumulate=0;
for j=1:c.trials %e.g. 398 trials
spikes_in_trial=c.spike_end(j)-c.spike_start(j)+1; %find spikes in this trial
accumulate=spikes_in_trial+accumulate; %total spikes for cell
for k=accumulate-spikes_in_trial+1:accumulate
tempsave(j,c.spikes(k))=1000; %1000 to convert to Hz %error occurs here at j=241 , k=24023
end
end
%where in this example c.trials is [398], c.spike_start is [398x1], c.spike_end is [398x1] and c.spikes is [42004x1]
Even when I try and divide this into 2 separate for loops (for j=1:c.trials/2) I get the same error at the exact same point (trial 241).
I tried all types of solutions that worked for other people to no avail. Any ideas?
Oh and for what it's worth my memory stats: Maximum possible array: 1176 MB (1.233e+009 bytes) Memory available for all arrays: 2550 MB (2.674e+009 bytes) * Memory used by MATLAB: 276 MB (2.899e+008 bytes) Physical Memory (RAM): 3510 MB (3.681e+009 bytes)
댓글 수: 1
Walter Roberson
2011년 9월 23일
Exactly what value does c.spikes(24023) have?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Electrophysiology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!