I am seeing a slew of warnings below which seem to be arising from the use of temporary variables in one of my parfor loops. The warnings would make sense to me if I were using variables of the same name prior to entering the loop – parfor would clear those variables – but I am not doing so. Also, the warnings seem to be triggered by some, but not all of my temporary variables. Does anyone have any idea what else could cause this?
One possible clue: the variables named in the warnings are also the names of class properties in a class I have defined. I do have an object of this class prior to the loop and access its properties as obj.A, obj.B, etc… but I don't see why that would be a cause for the warnings.
Warning: File: LineSegParsing.m Line: 120 Column: 33The temporary variable coords will be cleared at the beginningof each iteration of the parfor loop.Any value assigned to it before the loop will be lost. If coords is used before it is assigned in the parforloop, a runtime error will occur.See Parallel for Loops in MATLAB, "Temporary Variables". Warning: File: LineSegParsing.m Line: 116 Column: 38The temporary variable A will be cleared at the beginning of each iteration of the parfor loop.Any value assigned to it before the loop will be lost. If A is used before it is assigned in the parforloop, a runtime error will occur.See Parallel for Loops in MATLAB, "Temporary Variables". Warning: File: LineSegParsing.m Line: 152 Column: 25The temporary variable B will be cleared at the beginning of each iteration of the parfor loop.Any value assigned to it before the loop will be lost. If B is used before it is assigned in the parforloop, a runtime error will occur.
Best Answer