storing value in 2D array in a parfor loop
Show older comments
I have something like following
R = [1, 2, 3, 4, 5];
A1 = sparse(5,5);
A2 = sparse(5,5);
parfor i = 1 : size(A1,1)
A1(i,i) = R(i);
%do a lot of things to get "j"
A2(i,j) = 1;
end
This gives notorious "Error: The variable A1 in a parfor cannot be classified.". Even if I comment out first line in parfor loop, I will still get error because of A2.
Also, I can't save data in 3rd dimension i.e.
A1(:,:,i) = R(i);
because my A1 matric is sparse matrix. I need it to be sparse.
Can someone tell me any way around this error?
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance 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!