When trying to run the code below:
outfname = ["path\to\file"];
poolobj = gcp;
imgdata = load('testdata.mat');
parfor idx = 1:300
idxCopy = idx;
if strlength(string(idx)) == 1
idxCopy = strcat('00', string(idx));
elseif strlength(string(idx)) == 2
idxCopy = strcat('0', string(idx));
this_outfname = [outfname, idxCopy, ".jpg"];
some_function(this_outfname, imgdata, idx);
where 'imgdata' is a struct with each row having data that is unique to it's associated image. That is, every element of the struct is variable. Comments are my understandings of what I'm trying to do.
Having been unable to find a working solution, this is the output that I am getting:
Warning: Files that have already been attached are being ignored. To see which files are attached see the
'AttachedFiles' property of the parallel pool.
ProcessPool with properties:
IdleTimeout: 30 minutes (23 minutes remaining)
Analyzing and transferring files to the workers ...
Error using try_exifwrite (line 15)
An UndefinedFunction error was thrown on the workers for 'imgdata'. This might be because the file containing
'imgdata' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be
attached. For more information, see the documentation for 'parallel.Pool/addAttachedFiles'.
Unrecognized function or variable 'imgdata'.
Thank you for any help!