How to overcome this error "variable in a parfor cannot be classified"??
Show older comments
I have a code that a part of it looks like this simple example:
solution=cell(1,2);
solution{1}=zeros(100000,10);
solution{2}=zeros(100000,1);
parfor Xi=1:size(solution{1},1)
Min_cost=10^9;
for Xj=1:10
Iter_mat=[Xj/1 Xj/2 Xj/3 Xj/4 Xj/5 Xj/6 Xj/7 Xj/8 Xj/9 Xj/10];
Total_cost=Xi^2-Xi;
if Total_cost<Min_cost
Min_cost=Total_cost;
solution{1}(Xi,:)=Iter_mat;
solution{2}(Xi)=Min_cost;
end
end
end
but, I get this error messege: (Error: The variable solution in a parfor cannot be classified. See Parallel for Loops in MATLAB, "Overview".)
I have read the Matlab help and tried many to solve the problem, but I failed.
Any help is appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Nearest Neighbors in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!