In order to understand the matlabpool parallel processing, I tried a simple example.
spmd %the statement from the Parallel computing toolbox% Run all the statements in parallelif labindex==1a=2endif labindex==2b=3enda+bend
The expected result is supposed to be 5, but in reality there is a error:
An UndefinedFunction error was thrown on the workers for 'a'. This may be because the file containing 'a' is not accessible on the workers. Specify the required files for this parallel pool using the command: addAttachedFiles(pool, …). See the documentation for parpool for more details. Undefined function or variable "a".
How to fix this problem