I am having difficulty trying to speed up code by using parfor and pre-defining variable dimensions. The original code looks something like this(abbreviated):
for i = 1 : num_files_in_folder Flag = true; foldername = files_in_folder(i).name; try info = dicominfo(foldername); catch ME Flag = false; warning("Problem: dicominfo error."); DB2(i,1) = "Bad DICOM File"; DB2(i,2) = foldername;% rethrow(ME);
end %%try
...
When trying to speed it up with parfor I get the "cannot be classified" and other similar error messages.
Then I tried moving some of these temporary variables outside and making them an structured array. Note: I have ram to spare, even with a 8G ram disk. So big variable are not an issue yet.
Best Answer