How do I use objects with inheritance structures in a `parfor` loop in Matlab?
I am trying to parallelize a simulation that uses a custom library. Within the ‘parfor’ loop I am using, I receive the following error:
Error using sensor/readdata
Unrecognized field name "sensorDevice".
The object is an instance of Sensor that inherits its .sensorDevice field from its parent class. The method readdata calls on the inherited field. This works fine in a for loop. The transparency requirements for variable definitions and the corresponding documentation emphasize the ability of all variables to be machine-readable, but I do not follow why the parfor loop cannot trace the pointers to the parent classes’ fields and methods. Re-writing the class in a flattened structure is not an option due to the time that would be required to do so.
How do I use methods and fields from a parent class in an instance of a child class in a parfor loop?I am trying to parallelize a simulation that uses a custom library. Within the ‘parfor’ loop I am using, I receive the following error:
Error using sensor/readdata
Unrecognized field name "sensorDevice".
The object is an instance of Sensor that inherits its .sensorDevice field from its parent class. The method readdata calls on the inherited field. This works fine in a for loop. The transparency requirements for variable definitions and the corresponding documentation emphasize the ability of all variables to be machine-readable, but I do not follow why the parfor loop cannot trace the pointers to the parent classes’ fields and methods. Re-writing the class in a flattened structure is not an option due to the time that would be required to do so.
How do I use methods and fields from a parent class in an instance of a child class in a parfor loop? I am trying to parallelize a simulation that uses a custom library. Within the ‘parfor’ loop I am using, I receive the following error:
Error using sensor/readdata
Unrecognized field name "sensorDevice".
The object is an instance of Sensor that inherits its .sensorDevice field from its parent class. The method readdata calls on the inherited field. This works fine in a for loop. The transparency requirements for variable definitions and the corresponding documentation emphasize the ability of all variables to be machine-readable, but I do not follow why the parfor loop cannot trace the pointers to the parent classes’ fields and methods. Re-writing the class in a flattened structure is not an option due to the time that would be required to do so.
How do I use methods and fields from a parent class in an instance of a child class in a parfor loop? parfor, parallel computing MATLAB Answers — New Questions