Multiple combinations of huge data set
2 ビュー (過去 30 日間)
古いコメントを表示
Hello I'm following this post:
https://www.mathworks.com/matlabcentral/answers/98191-how-can-i-obtain-all-possible-combinations-of-given-vectors-in-matlab
The think is I need to do the same with the following this range of data
elements = {400:499,500:599,600:699,700:900}; %cell array with N vectors to combine
combinations = cell(1, numel(elements)); %set up the varargout result
[combinations{:}] = ndgrid(elements{:});
combinations = cellfun(@(x) x(:), combinations,'uniformoutput',false); %there may be a better way to do this
result = [combinations{:}]; % NumberOfCombinations by N matrix. Each row is unique.
When I run the code you posted just changing the values to those I need, I reach a limit of 201000000 x 4, the last combination calculated is 403,513,620, 729.
How can I modify the code or to get all calculations, last one should be 499,599,699,799,900?
Even if I need to create more than one variable file to save the calculations will be good.
Thank you.
0 件のコメント
回答 (1 件)
James Browne
2019 年 6 月 15 日
編集済み: James Browne
2019 年 6 月 15 日
Greetings,
I would think you are maxing out your memory allocation, considering you have 201 million rows in your result...If you can increase your memory allocation for MATLAB, that might fix it, otherwise, you have to implement the algorithm for creating all combinations, manually, and then intermittently save results to a data file so that you do not max out your memory. There may be another solution but those are the options that would pop into my head if I were trying to solve this problem~
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!