Structural arrays on parfor loop
Show older comments
Hello,
I am using a parfor loop in the following nested structure:
parfor
for
for
end
end
end
I am also importing a few variables as structural arrays into my code and this must be reason why I'm receiving the following message:
%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.
where x is a variable that receives a value of a cell out of a structural array.
STEP 1: To avoid this I replaced every structural array defined variable into a double outside the parfor loop. The error remained.
STEP 2: As suggested, used the command
addAttachedFiles({'file1.mat','file2.mat'})
to specify the structural array files inside the parfor loop even though I had already gotten rid of them before. The error remained.
Any suggestions?
Thanks in advance,
Kyriakos
Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!