out of memory error

조회 수: 4 (최근 30일)
hadi mostafavi amjad
hadi mostafavi amjad 2020년 11월 8일
편집: Jakob Wagner 2020년 11월 18일
hi
i have this code, and the loading file is a huge cell arre with matrix in each cell. so when i run this code i get out of memory error. my memory storage is 6 GB, and i test it on 8GB memory storage but again i got the same error. So is there any solution for my code to work faster and lighter?!!!
clc,close all, clear all
load EE_Scenario1_82_31_3000_3000_800_3E-4_-90.mat % this is 600.0 MB.
for i0 = 1:size(EE_TOT)
i = 1;
j = 1;
for j0 = 1:size(EE_TOT)
if (~isempty(EE_TOT{i,j})) & (INDEX{i,j}(i,:) > 0)
MeanEE(i0,j0) = mean(mean((EE_TOT{i,j}(INDEX{i,j}(:)))));
else
continue
end
j = j+1;
end
end
M_TOT = mean(mean(MeanEE));
  댓글 수: 1
Jakob Wagner
Jakob Wagner 2020년 11월 18일
편집: Jakob Wagner 2020년 11월 18일
I had a similar issue half a year ago, but using tall arrays and parallel computing ("parfor" using both of my cores for computing), your RAM has to do less work at once while your calulation time gets lowered significantly.
best regards
% get your path
[openfile openpath]=uigetfile('*.lvm')
% decrease your RAM torture
ds=tabularTextDatastore([openpath openfile],...
'FileExtensions','.lvm',...
'Delimiter','\t',...
'NumHeaderLines',23,...
'ReadVariableNames',0);
% make it a tall array (Your program only loads a subset of your Datastorage at once)
Arr=tall(ds);
% do here, whatever needs to be done with the whole dataset
Arr=gather(Arr);
%do here, what needs to be done to analyze and refine

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by