%% factoreffectchart

function  out = factoreffectchart( D,T )
% factoreffectchart function
%   D : orthogonalarray�@T: data  out: matrix of factoreffectchart 
%
% Copyright 2016 The MathWorks, Inc.

r = length(D(1,:));
mn = min(D);
mx = max(D);

out = NaN(r,max(D(:)));
for k = 1:r

    for v = mn(k):mx(k)
    id = D(:,k) == v;
    out(k,v) = mean(T(id));
    end
end

for k = 1:r
subplot(1,r,k);plot(out(k,mn(k):mx(k)),'b--o');
xlim([mn(k)-0.1 mx(k)+0.1]);ylim([min(out(:))-0.1*abs(min(out(:))) max(out(:))+0.1*abs(max(out(:)))])
xlabel([num2str(k) 'st param'])
end

end