Effacer les filtres
Effacer les filtres

An UndefinedFunction error was thrown on the workers with parfor

57 vues (au cours des 30 derniers jours)
Dave Lee
Dave Lee le 19 Oct 2018
Commenté : Dave Lee le 19 Oct 2018
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
  4 commentaires
Walter Roberson
Walter Roberson le 19 Oct 2018
x = cell(1, 1);
before the parfor.
Dave Lee
Dave Lee le 19 Oct 2018
Thanks! it helps.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Parallel for-Loops (parfor) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by