clc; clear all;
addpath '../CM'
subject = {'Alina','Angela','Anton','Bob','Carly','Edward','Evan','Joanna', 'Latisha','Laura','Miguel','Norene','Shauna','Teddy','Tony'};


CV_ORDER={'vow_inital', 'vow_final', 'con_inital', 'con_final'};
CM_Range={'A1:P16', 'A1:P16', 'A1:Z26', 'A1:Z26'};

%loop over subjects
for subj_i = 1:length(subject)
    fname=[subject{subj_i} '.xls'];
    for order_i=1:length(CV_ORDER)
        [num,txt,raw] = xlsread(fname,order_i,CM_Range{order_i});
        %cm=cell2mat(raw);
        %cm(isnan(cm))=0;
        for i=1:length(raw)
            for ii=1:length(raw)
                if isnan(raw{i,ii})
                    raw{i,ii}='';
                elseif i>1 && ii>1
                    raw{i,ii}=char(num2str(raw{i,ii}));
                end
            end
        end
        switch order_i
            case 1
                prin1=raw;
            case 2
                prin2=raw;
            case 3
                prin3=raw;
            case 4
                prin4=raw;
            otherwise
        end
    end
    save(['../CM/' subject{subj_i} '_updated'], 'prin*');
    disp([subject{subj_i} '.xls is incorporated into ' subject{subj_i} '_updated.mat']);
end

