I have a structure with programatically generated fieldnames (let's call it myStruct), and an optimization program (let's call it optfunc) needs to run on data contained in each fieldname. I would like to use parfor to accelerate the process, but the normal way to loop through structs creates unclassified variables. Any tips on how this can be fixed? E.g.:
myFields = fieldnames(myStruct);nFields = size(myFields,1);parfor iField = 1:nFields dataSet = myStruct.(myFields{iField}); optOut = optfunc( dataSet );end
Best Answer