function [ outputmat, label_train ] = ClasificationTable( vystup, nrofpatients )
%% Funkce pro vypocet klasifikacnich stromu
%
% vystup - cell vypocitanych parametru
% nrofpatients - pocet vsech pocitanych recniku

%% Priprava promennych
outputmat = cell(1150); % Pripraveni cell pro vyplneni

%% vytvoreni label_train pro dany pocet pacientu
for i=2:nrofpatients+1
   nazevPacienta = char(vystup(1,i));
   if nazevPacienta(1) == 'K'
       label_train(1,i-1) = 0;
   else if nazevPacienta(1) == 'P'
           label_train(1,i-1) = 1;
       end
   end    
end 

%% Vyber trenovacich parametru a natrenovani
for row=2:length(vystup);
    disp(['pocitam radek c. ' num2str(row)]);

   for coll=2:nrofpatients+1;
       
        % Priprava trenovaciho label_train
       label_train_2 = label_train(coll:length(label_train));
       table_train_2 = cell2mat(vystup(row,coll+1:nrofpatients+1));
       
        if coll==2
           label_train_3 = label_train_2;
           table_train_3 = table_train_2;
        else
           label_train_1 = label_train(1:coll-2);
           table_train_1 = cell2mat(vystup(row,2:coll-1));
       
           label_train_3 = [label_train_1 label_train_2];
           table_train_3 = [table_train_1 table_train_2];
        end
       
       table_test = cell2mat(vystup(row,coll)); % pripravena testovaci matice
        % Natrenovani
        obj = ClassificationTree.fit(table_train_3',label_train_3', 'Prior', 'uniform','SplitCriterion', 'gdi');
        outputmat(row,coll) = num2cell(predict(obj, table_test)); % ulozeni vysledku do pripraveneho cellu
    
   end
end
end

