You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: fittedValues.m
    path of file: ./repos/matStats/matStats/@Anova
    
    the code of the file until where you have to start completion: function res = fittedValues(this, factors)
%FITTEDVALUES Compute fitted values for factors or group of factors
%
%   VALUES = fittedValues(ANOVA)
%

    
function res = fittedValues(this, factors)
%FITTEDVALUES Compute fitted values for factors or group of factors
%
%   VALUES = fittedValues(ANOVA)
%
%   Example
%     % Estimate petal length of each iris species 
%     iris = Table.read('fisherIris');
%     species = iris('Species');
%     anovaPL = Anova(iris('PetalLength'), species);
%     fittedValues(anovaPL, species)
%       ans = 
%                                 fitted.values
%       Species=Setosa                    1.464
%       Species=Versicolor                 4.26
%       Species=Virginica                 5.552
%
%   See also
%     coefficients, Table/aggregate
%

% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% Created: 2013-01-29,    using Matlab 7.9.0.529 (R2009b)
% Copyright 2013 INRA - Cepia Software Platform.

% First compute combinations of factors that exist in factor table
factorCombos = unique(factors);

% Find correspondence between indices of factors and indices in original
% Anova model.
nFactors = size(factors, 2);
groupInds = zeros(1, nFactors);
for i = 1:size(factors, 2)
    groupInds(i) = find(strcmp(factors.ColNames{i}, this.Stats.varnames, 'exact'));
end