Error using Parfor "Unable to classify the variable 'Sort'"
Show older comments
Please help, pulling my hair out;
The following code is meant to sift through arrays Sort and Sort2 looking for intersections, and then if it finds one it reassigns that line (k) to all zeros. Sort is 16.777E6 x 24, and Sort2 is 24x24 matrix. k runs from 1 to Np = 16.777E6. This segment of the whole program takes considerable time with very, very large versions of Sort, so I am trying to use parfor to speed things up. I assumed this could be done because the results of any line Sort(k) do not affect any other line of Sort(k).
The error specifically says "Error using Solver_V (line 647)
Error: Unable to classify the variable 'Sort' in the body of the parfor-loop. For more information, see Parallel for Loops in MATLAB, "Solve Variable Classification Issues in
parfor-Loops".
The offending portion of code is below, and I included the full files for context.
Thank you so much!
parfor k=1:Np
for i=1:(Nu-1)
for j=(i+1):Nu
if Sort(k,i)*Sort(k,j)==1 && Sort2(i,j)==0
Sort(k,:)=zeros;
flag=1;
break
end
end
if flag==1
flag=0;
break
end
end
if mod(count2,10E6)==0
count2-count1
count2
end
count2=count2+1;
end
Accepted Answer
More Answers (1)
I just came here to mention that we tried to improve the error reporting for this case. Here's what happens now, hopefully it makes more sense.
parfor k=1:Np
for i=1:(Nu-1)
for j=(i+1):Nu
if Sort(k,i)*Sort(k,j)==1 && Sort2(i,j)==0
Sort(k,:)=zeros;
flag=1;
break
end
end
if flag==1
flag=0;
break
end
end
if mod(count2,10E6)==0
count2-count1
count2
end
count2=count2+1;
end
Categories
Find more on Parallel Computing Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!