Select specific range of combinations without getting memory error.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am creating a mesh grid or combination vector of an array. The full combination vector is so large that MATLAB prompts me "out of memory" error. I have written a code to create the mesh grid, depending on the variable "Col".
Col=9;
numMatrix = uint8([1 2 3]);
meshString=strcat("a3 = combvec(" ,repmat('numMatrix ,', 1, Col-1), "numMat )")
eval(meshString);
If the Col value is 9, then the size of the matrix formed is this.
Variable Size Byte
a3 9x19683 1417176 double
The problem with this code is that if my Col value is 25, then the size of a3 will be 25x3^25 which require the RAM of 25*3^25*8/1024/1024/1024 GB (1.5782e+05 GB) which is not realizable. So I want to create a specific range of combinations. For example, to have only the first 50000 combinations directly then after the processing goes for the next 50000.
P.S: I have also used the function [b1,b2....,b25]=ndgrid(1:3) to create the b's grids and then flattening them to form the combination. It also suffers from the same problem explained above
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!