function print_tab2_results(tab_desc,selsbj,catype_desc,redcaAMX);
% col.1:    visit
% col.2:    day
% col.3:    block
% col.4:    s.type (1=training; 2=feedback; 3=open question sessions)
% col.5:    progressive n. of days
% col.6:    CA
% col.7:    NT
% col.8:    NF
% col.9:    CHLEV_TR
% col.10:   CHLEV_FO
% col.11:   N.open question sessions
% col.12:   CA_TR above chance
% col.13:   CA_FO above chance
%
unique_days = unique(redcaAMX(:,5));
ndays_ca_above_ch_TR = 0;
ndays_ca_above_ch_FO = 0;
ndays_tot_FO = 0;
amCAvTR = [];
amCAvFO = [];
fprintf('*** file ''%s.mat''\n',tab_desc);
fprintf('*** subject ''%s'' all sessions day-wise classification accuracy of ''%s'', N=%d; NTR=%d; NFB=%d; NOQ=%d:\n',...
    char(selsbj),catype_desc,size(redcaAMX,1),...
    length(find(redcaAMX(:,4) == 1)), length(find(redcaAMX(:,4) == 2)), length(find(redcaAMX(:,4) == 3)));
fprintf('---------------------------------------------------------------------------------------------------------------------------------------------------\n');
fprintf('N.\tVISIT\tDAY\tBLOCKS\tNT\tNF\tminNS\tTHR\tmCA\tsCA\tABOVE CHANCE\tNfo\tminFO\tNoq\tTHRfo\tmCAfo\tsCAfo\tABOVE CHANCE\n');
fprintf('(n.)\t(n.)\t(n.)\t(n.)\t(n.)\t(n.)\t(n.)\t(%%)\t(%%)\t(%%)\t(*)\t\t(n.)\t(n.)\t(n.)\t(%%)\t(%%)\t(%%)\t(*)\n');
for k=1:length(unique_days),
    a_day = unique_days(k);
    nx_day = find(redcaAMX(:,5) == a_day);
    shortredcaAMX = redcaAMX(nx_day,:);
    a_visit = shortredcaAMX(1,1);
    a_blocks_TR = length(find(shortredcaAMX(:,4) == 1));
    a_blocks_FO = length(find(shortredcaAMX(:,4) > 1));
    NT_TR = sum(shortredcaAMX(find(shortredcaAMX(:,4) == 1),7));
    NF_TR = sum(shortredcaAMX(find(shortredcaAMX(:,4) == 1),8));
    NT_FB = sum(shortredcaAMX(find(shortredcaAMX(:,4) == 2),7));
    NF_FB = sum(shortredcaAMX(find(shortredcaAMX(:,4) == 2),8));
    NF_OQ = sum(shortredcaAMX(find(shortredcaAMX(:,4) == 3),11));
    minNS_TR = min([NT_TR, NF_TR])*2;
    %[k, NT_TR, NF_TR, minNS_TR]
    minNS_FO = min([NT_FB, NF_FB])*2;
    a_mean_CA_TR = mean(shortredcaAMX(find(shortredcaAMX(:,4) == 1),6));
    a_std_CA_TR = std(shortredcaAMX(find(shortredcaAMX(:,4) == 1),6),0,1);
    if (a_blocks_FO == 0),
        a_mean_CA_FO = 0.0;
        a_std_CA_FO = 0.0;
    else,
        all_CA_FO = shortredcaAMX(find(shortredcaAMX(:,4) > 1),6);
        a_mean_CA_FO = mean(all_CA_FO);
        a_std_CA_FO = std(all_CA_FO,0,1);
        ndays_tot_FO = ndays_tot_FO + 1;
    end;
    THR_TR = get_chance_level_upper_limit2(minNS_TR/2,minNS_TR/2)*100;
    THR_FO = get_chance_level_upper_limit2(minNS_FO/2,minNS_FO/2)*100;
    shortredcaAMX(:,9) = THR_TR;
    shortredcaAMX(:,10) = THR_FO;
    if (a_mean_CA_TR > THR_TR),
        above_ch_lev_TR = '*';
        shortredcaAMX(:,12) = 1;
        ndays_ca_above_ch_TR = ndays_ca_above_ch_TR + 1;
        amCAvTR = [amCAvTR; a_mean_CA_TR];
    else,
        above_ch_lev_TR = ' ';
        shortredcaAMX(:,12) = 0;
    end;
    if (a_blocks_FO == 0),
        above_ch_lev_FO = ' ';
        shortredcaAMX(:,13) = 0;
    else,
        day_fo_okay = 0;
        for j=1:size(shortredcaAMX,1),
            if (shortredcaAMX(j,4) > 1),
                if (shortredcaAMX(j,6) > THR_FO),
                    shortredcaAMX(j,13) = 1;
                    day_fo_okay = 1;
                    amCAvFO = [amCAvFO; shortredcaAMX(j,6)];
                end;
            end;
        end;
        if (day_fo_okay),
            above_ch_lev_FO = '*';
            ndays_ca_above_ch_FO = ndays_ca_above_ch_FO + 1;
        else,
            above_ch_lev_FO = ' ';
        end;
    end;
    redcaAMX(nx_day,:) = shortredcaAMX;
    fprintf('%d\t%d\t%d\t%d\t%d\t%d\t%d\t%1.1f\t%1.1f\t%1.1f\t%s\t\t%d\t%d\t%d\t%1.1f\t%1.1f\t%1.1f\t%s\n',...
        k, a_visit, a_day, a_blocks_TR, NT_TR, NF_TR, minNS_TR, THR_TR, a_mean_CA_TR, a_std_CA_TR, above_ch_lev_TR,...
        a_blocks_FO, minNS_FO, NF_OQ, THR_FO, a_mean_CA_FO, a_std_CA_FO,above_ch_lev_FO...
        );
end;
fprintf('---------------------------------------------------------------------------------------------------------------------------------------------------\n');
% training
nsent_ca_TR_above_ch = sum([...
    redcaAMX(find(redcaAMX(:,12)==1 & redcaAMX(:,4)==1),7);...
    redcaAMX(find(redcaAMX(:,12)==1 & redcaAMX(:,4)==1),8)...
    ]);
nsent_tot_TR = sum([redcaAMX(find(redcaAMX(:,4)==1),7); redcaAMX(find(redcaAMX(:,4)==1),8)]);
max_thr_TR = max(redcaAMX(find(redcaAMX(:,4) == 1),9));
fprintf('TRAINING (%s):\n',catype_desc);
fprintf('ndays_ca_above_chance:\t%d/%d (%1.1f%%)\n',ndays_ca_above_ch_TR,length(unique_days),100*ndays_ca_above_ch_TR/length(unique_days));
fprintf('max_chance_level     :\t%1.1f%%\n',max_thr_TR);
fprintf('mean_ca_above_chance :\t%1.1f +/- %1.1f\n',mean(amCAvTR),std(amCAvTR,0,1));
fprintf('nsent_ca_above_chance:\t%d/%d (%1.1f%%)\n',nsent_ca_TR_above_ch,nsent_tot_TR,100*nsent_ca_TR_above_ch/nsent_tot_TR);
% feedback and open question sessions
fprintf('\n');
nsent_ca_FO_above_ch = sum([...
    redcaAMX(find(redcaAMX(:,13)==1 & redcaAMX(:,4)>1),7);...
    redcaAMX(find(redcaAMX(:,13)==1 & redcaAMX(:,4)>1),8);...
    redcaAMX(find(redcaAMX(:,13)==1 & redcaAMX(:,4)>1),11)...
    ]);
nsent_tot_FO = sum([redcaAMX(find(redcaAMX(:,4)>1),7); redcaAMX(find(redcaAMX(:,4)>1),8); redcaAMX(find(redcaAMX(:,4)>1),11)]);
max_thr_FO = max(redcaAMX(find(redcaAMX(:,4) == 2),10));
fprintf('FEEDBACK & OPEN QUESTION SESSIONS (%s):\n',catype_desc);
fprintf('ndays_ca_above_chance:\t%d/%d (%1.1f%%)\n',ndays_ca_above_ch_FO,ndays_tot_FO,100*ndays_ca_above_ch_FO/ndays_tot_FO);
fprintf('max_chance_level     :\t%1.1f%%\n',max_thr_FO);
fprintf('mean_ca_above_chance :\t%1.1f +/- %1.1f\n',mean(amCAvFO),std(amCAvFO,0,1));
fprintf('nsent_ca_above_chance:\t%d/%d (%1.1f%%)\n',nsent_ca_FO_above_ch,nsent_tot_FO,100*nsent_ca_FO_above_ch/nsent_tot_FO);
%
% fprintf('ini-redcaAMX: N=%d; NTR=%d; NFB=%d; NOQ=%d\n',size(redcaAMX,1),...
%     length(find(redcaAMX(:,4) == 1)), length(find(redcaAMX(:,4) == 2)), length(find(redcaAMX(:,4) == 3)));
% redcaAMX
% size(redcaAMX)
% fprintf('end-redcaAMX\n');
return;
