When I try to execute the above code with parfor instead of using for, I get the following error :
Error: The variable study in a parfor cannot be classified. See Parallel for Loops in MATLAB, "Overview".
I think the "Form of Indexing : Within the list of indices for the variable, exactly one index involves the loop variable." rule for sliced variables in parfor is causing the issue. (Because study(i).run(j) has not been indexed according to parfor requirements.) But since I have a structure with different fields and I need to update the field 'run' in the structure 'study', is there any way i could make this code compatible with parfor ? Any help/suggestion is really appreciated!
Best Answer