To be a sliced output variable, tt
must be indexed using literally only the loop variable i
, and other constant terms (including :
). Perhaps you can make tt
rectangular, and assign a whole column at a time, and then reshape later, something like this:
tt = zeros(3, 10);
parfor ii = 1:10
tt(:, ii) = [ii; ii; ii];
end
tt = reshape(tt, 1, numel(tt));