Filter löschen
Filter löschen

Select specific range of combinations without getting memory error.

2 Ansichten (letzte 30 Tage)
Masood Salik
Masood Salik am 15 Sep. 2021
Bearbeitet: Masood Salik am 15 Sep. 2021
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

Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by