Error when assigning table columns in parfor loop with some worker numbers

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by