out of memory error

3 次查看(过去 30 天)
hadi mostafavi amjad
编辑: 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