out of memory error

3 visualizzazioni (ultimi 30 giorni)
hadi mostafavi amjad
hadi mostafavi amjad il 8 Nov 2020
Modificato: Jakob Wagner il 18 Nov 2020
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 Commento
Jakob Wagner
Jakob Wagner il 18 Nov 2020
Modificato: Jakob Wagner il 18 Nov 2020
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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Text Data Preparation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by