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?
Best Answer