Error when assigning table columns in parfor loop with some worker numbers
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using the latest Matlab 2020a.
The code below only works when n <= the number of workers or when n is a muptiple of the number of workers.
For example, when I set my pool worker to 12, it raises "Cannot create a table variable with a discontiguous index." error.
But it works perfectly after I set my pool worker to 7, or change n to something less than 13.
It seems that some idle workers try to fill in non-existing columns when other workers are doing the last iteration.
Does anyone have any idea about this?
n = 14;
t = table('Size', [1, n], 'VariableTypes', repmat("double", [1, n]));
parfor i = 1:n
t{:, i} = i;
end
By the way this is not a problem when filling table rows like the following example, with any n and worker number.
n = 14;
t = table('Size', [n, 2], 'VariableTypes', repmat("double", [1, 2]));
parfor i = 1:n
t{i, :} = [i, i];
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!