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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!