function show_rap_confusion(conf,nref,nameref,ntest,nametest) % show_rap_confusion(conf,nref,nameref,ntest,nametest) % % conf - confusion matrix % nref - no of reference phonemes. % nameref - filename w/ reference labels (two col - index and name) % ntest - no of test phonemes. % nametest - filename w/ test labels (two col - index and name) % % setting BW-colormap. % let the image out ! %imagesc(conf); % if we want the image w/o silence, must do this: %conf = conf(1:(nref-1),1:(ntest-1)) %conf = [conf zeros(nref-1,1); zeros(1,ntest)]; %for pcolor, must complete by some junk last col and row ... conf = [conf zeros(nref,1); zeros(1,ntest+1)]; pcolor(conf); axis ij; c=colormap('gray'); colormap(flipud(c)); colorbar; brighten(-0.3); % a bit of darkening ... %%%%%%%%%%%% labels - ref. list_phn_ref=[]; ff=fopen(nameref,'r'); for ii=1:nref, dummy=fscanf(ff,'%s',[1 1]); str=fscanf(ff,'%s',[1 1]); if ii==1, list_phn_ref=str; else list_phn_ref=str2mat(list_phn_ref, str); end end fclose(ff); % put them on axis h=gca; set (h,'fontsize',8); %set (h,'fontweight','bold'); set(h,'ytick', (1:nref) + 0.5); set (h,'yticklabel', list_phn_ref) %%%%%%%%%%%%%% labels - test. list_phn_test=[]; ff=fopen(nametest,'r'); for ii=1:ntest, dummy=fscanf(ff,'%s',[1 1]); str=fscanf(ff,'%s',[1 1]); if ii==1, list_phn_test=str; else list_phn_test=str2mat(list_phn_test, str); end end fclose(ff); % put them on axis h=gca; set (h,'fontsize',8); %set (h,'fontweight','bold'); set(h,'xtick', (1:ntest) + 0.5); set (h,'xticklabel', list_phn_test)