フィルターのクリア

Saving cell to file to save RAM

1 回表示 (過去 30 日間)
Jordan Coombs
Jordan Coombs 2020 年 12 月 3 日
I am trying to run this code to give me my values in a cell, however i am dealing with a large amount of data and it usually crashes around the 6th iteration of j. I was wondering is there any way i can optimise this or save to file line by line to save RAM. I am very new to matlab so any help is appreciated.
j = 1;
while j <= 4
%inputdir = 'C:\Users\jorda\Desktop\Physics Project\Country PM25';
%outputfile = 'Africa_With_Dust'; %do not put it into inputdir !
%dinfo = dir( fullfile(inputdir, '*.mat') );
%filenames = fullfile( inputdir, {dinfo.name} );
PM_val = ncread(With_Dust_List(j),'PM25');
i = 1;
j = j + 1;
while i <= 51
mat_zer=zeros(2600,7200);
isin1 = inpolygon(LON,LAT,S(i).X,S(i).Y);
mat_zer(isin1)=st(i);
[row1,col1] = find(mat_zer~=0);
mat_zer_pm = PM_val;
inds1 = sub2ind(size(mat_zer_pm),row1,col1);
new_mat1 = nan(size(mat_zer_pm));
new_mat1(inds1) = mat_zer_pm(inds1);
Country_With{i,j} = new_mat1;
i = i + 1;
end
%for K = 1 : length(filenames)
%thisfile = load(filenames{K});
%save(outfile, '-struct', 'Country_With{1:51,j-1}', '-append');
%end
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by