Save results to disk in a loop/RAM Memory problem
显示 更早的评论
Hello,
I am having problems with the limit of RAM memory. In my application, I have a loop like the following:
%% 1. Data obtaining
n_loops=1000;
all_results = zeros(dim1, dim2, n_loops)
for i=1:n_loops
%result_of_one_loop = get_result_command;
all_results(:,:,i) = result_of_one_loop;
end
%% 2. Post-processing
%Post-procesing code here.
This code runs out the RAM. Is there any option to solve this problem? Maybe saving into the disk memory the results file, increasing the size in each loop (but not overwriting)? Thank you so much for your help.
2 个评论
Jan
2023-1-26
This piece of code is too simplified, to explain the source of the problem. If the pre-allocation zeros(dim1, dim2, n_loops) is working successfully, filling the memory is no reason for further allocations.
Please postr some code, which reproduces the problm and pos a copy opf the complete error message. This will show us, which line is failing.
JORGE REVUELTA LOSADA
2023-2-3
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!