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

1 回表示 (過去 30 日間)
KUAN TING HO
KUAN TING HO 2020 年 4 月 24 日
編集済み: KUAN TING HO 2020 年 4 月 24 日
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 Center および File ExchangeLoops 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