matlab - How to pass values into a matrix with discontinuous index in parfor loop -
i have met problem when passing values specific position in matrix in parfor loop. example:
array2 = zeros(6,3); ind = [1,3,5]; parfor i=1:3 array1 = [1,2,3;4,5,6]; % generated function x(i); array2(ind(i):ind(i)+1,1:3) = array1(1:2,1:3); end
one function calculate , generate different array1 different i. want save results array2. when used simple loop, worked well. when tried apply parfor loop, error came: error: variable array2 in parfor cannot classified. can provide way circumvent problem? many thanks!
Comments
Post a Comment