I have the following simple MATLAB code:
B = integer; % Doesn't change
n = integer; % Doesn't change
X = vector; % Doesn't change
Y = vector; % Doesn't change
V_final = zeros(m,4);
residuals_final = zeros(m,1);
parfor q = 1:m
[V_low residuals_low] = customfunction(B, n, X, Y); % function contains loop of n iterations
% V_low is a 2x2 matrix, residuals_low is a floating point number
V_final(q,1) = V_low(1,1);
V_final(q,2) = V_low(1,2);
V_final(q,3) = V_low(2,1);
V_final(q,4) = V_low(2,2);
residuals_final(q) = residuals_low;
end
but get the error: The variable V_final in a parfor cannot be classified. Each iteration is independent of each other and I have pre-assigned everything I thought I needed to. Any help appreciated. Have looked at documentation (hard to relate to this situation, besides thought I'd done the right thing) and other answers to similar questions and either ther're not the same or can't see similarity.