function [CM] = loadcm(subject, cmpath)
% loads the CM data from mat files prepared by Christoph
%
%  [CM, SNR] = r_loadcm(subject)
%     CM = supposed to be 4 confusion matrices (16x17) in a cell array
%     subject - e.g. 'MJ-R-nalr'
nCM=4;

if nargin == 1
    %cmpath = 'cm_data_filter';  % path containing CM data
    cmpath = 'CM';
    %cmpath = 'cm_data_phases';
end


%subject = 'MJ-R'; 
load([cmpath, filesep, subject]);

%Creat Cells for Confusion Matrix
CM = cell(nCM, 1);

%Create Matrix for CM
matCMvow=zeros(15);
matCMcon=zeros(25);
for r=2:16
    for c=2:16
        matCMvow(r-1,c-1)=str2double(prin1{r,c});
    end
end
matCMvow(isnan(matCMvow)) = 0;
CM{1}=matCMvow;

for r=2:16
    for c=2:16
        matCMvow(r-1,c-1)=str2double(prin2{r,c});
    end
end
matCMvow(isnan(matCMvow)) = 0;
CM{2}=matCMvow;

for r=2:26
        for c=2:26
                matCMcon(r-1,c-1)=str2double(prin3{r,c});
        end
end
matCMcon=[matCMcon(:,1:3) matCMcon(:,5:25)];        %remove H
matCMcon=[matCMcon(1:3,1:24); matCMcon(5:25,1:24)];
matCMcon(isnan(matCMcon)) = 0;
CM{3}=matCMcon;

for r=2:26
    for c=2:26
        matCMcon(r-1,c-1)=str2double(prin4{r,c});
    end
end
matCMcon=[matCMcon(:,1:3) matCMcon(:,5:25)];        %remove H
matCMcon=[matCMcon(1:3,1:24); matCMcon(5:25,1:24)];
matCMcon(isnan(matCMcon)) = 0;
CM{4}=matCMcon;

