An UndefinedFunction error was thrown on the workers with parfor
Mostrar comentarios más antiguos
Hi,
I got the error
An UndefinedFunction error was thrown on the workers for 'x'. This might be because the file containing 'x' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files
to be attached. See the documentation for 'parallel.Pool/addAttachedFiles' for more details.
Caused by: Undefined function or variable "x"
when running the simple code below. Can anyone please help me with this?
Thanks,
clear all;
clc;
parfor n=1:1
for m=1:2
x{n}(m) = 1;
end
y = x{n}(1)
end
3 comentarios
Walter Roberson
el 19 de Oct. de 2018
Initialize x first and the problem will go away.
Dave Lee
el 19 de Oct. de 2018
Dave Lee
el 19 de Oct. de 2018
Respuestas (1)
Walter Roberson
el 19 de Oct. de 2018
Movida: Edric Ellis
el 11 de Ag. de 2025
x = cell(1, 1);
before the parfor.
Categorías
Más información sobre Parallel for-Loops (parfor) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
