Daniel@0: function display(m) Daniel@0: % DISSIMATRIX/DISPLAY display of a dissimilarity matrix Daniel@0: disp(' '); Daniel@0: d = get(m,'Data'); Daniel@0: nam = get(m,'Name'); Daniel@0: fp = get(m,'FramePos'); Daniel@0: cha = get(m,'Channels'); Daniel@0: t = get(m,'Title'); Daniel@0: tp = get(m,'TrackPos'); Daniel@0: tv = get(m,'TrackVal'); Daniel@0: pp = get(m,'PeakPos'); Daniel@0: g = get(m,'Graph'); Daniel@0: b = get(m,'Branch'); Daniel@0: for i = 1:length(d) Daniel@0: if iscell(d{i}) Daniel@0: d{i} = d{i}{1}; Daniel@0: end Daniel@0: l = size(d{1},3); % Number of channels Daniel@0: il = (1-0.15)/l; Daniel@0: figure Daniel@0: for k = 1:l % For each channel Daniel@0: if l>1 Daniel@0: subplot('Position',[0.1 (k-1)*il+0.1 0.89 il-0.02]) Daniel@0: end Daniel@0: fpi = cell2mat(fp{i}); Daniel@0: if size(fpi,1) == 2 Daniel@0: fpi = (fpi(1,:,:,:)+fpi(2,:,:,:))/2; Daniel@0: end Daniel@0: if strcmp(m.view,'l') Daniel@0: h = imagesc(fpi,fpi(1:size(d{i},1))-fpi(1),d{i}(:,:,k)); Daniel@0: else Daniel@0: h = imagesc(fpi,fpi,d{i}(:,:,k)); Daniel@0: end Daniel@0: if not(isempty(g)) Daniel@0: hold on Daniel@0: pi = cell(1,size(g{i}{1},2)); Daniel@0: for j = 1:size(g{i}{1},2) Daniel@0: pi{j} = sort(pp{i}{1}{j}); Daniel@0: end Daniel@0: for j = 1:size(g{i}{1},2) Daniel@0: for h = 1:length(g{i}{1}{1,j,l}) Daniel@0: next = g{i}{1}{1,j,l}{h}; Daniel@0: if length(next)>1 Daniel@0: for n = 1:size(next,1) Daniel@0: plot([fpi(j) fpi(next(n,1))],... Daniel@0: [fpi(pi{j}(h)) - fpi(1), ... Daniel@0: fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],... Daniel@0: 'k','LineWidth',1) Daniel@0: %plot([fpi(j) fpi(next(n,1))],... Daniel@0: % [fpi(pi{j}(h)) - fpi(1), ... Daniel@0: % fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],... Daniel@0: % 'w+','MarkerSize',10) Daniel@0: plot([fpi(j) fpi(next(n,1))],... Daniel@0: [fpi(pi{j}(h)) - fpi(1), ... Daniel@0: fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],... Daniel@0: 'kx','MarkerSize',10) Daniel@0: end Daniel@0: end Daniel@0: end Daniel@0: end Daniel@0: bi = b{i}{1}{1}; Daniel@0: for j = 1:size(bi,1)-1 Daniel@0: plot([fpi(bi(j,1)) fpi(bi(j+1,1))],... Daniel@0: [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ... Daniel@0: fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],... Daniel@0: 'w','LineWidth',1.5) Daniel@0: plot([fpi(bi(j,1)) fpi(bi(j+1,1))],... Daniel@0: [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ... Daniel@0: fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],... Daniel@0: 'w+','MarkerSize',15) Daniel@0: plot([fpi(bi(j,1)) fpi(bi(j+1,1))],... Daniel@0: [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ... Daniel@0: fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],... Daniel@0: 'kx','MarkerSize',15) Daniel@0: end Daniel@0: elseif not(isempty(tp)) && not(isempty(tp{i})) Daniel@0: hold on Daniel@0: for k = 1:size(tp{i}{1}{1},1) Daniel@0: prej = 0; Daniel@0: for j = 1:size(tp{i}{1}{1},2) Daniel@0: if tv{i}{1}{1}(k,j) Daniel@0: if prej% && not(isempty(tp(k,j))) Daniel@0: plot([fpi(prej) fpi(j)],... Daniel@0: [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ... Daniel@0: fpi(tp{i}{1}{1}(k,j)) - fpi(1)],... Daniel@0: 'k','LineWidth',1) Daniel@0: plot([fpi(prej) fpi(j)],... Daniel@0: [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ... Daniel@0: fpi(tp{i}{1}{1}(k,j)) - fpi(1)],... Daniel@0: 'w+','MarkerSize',10) Daniel@0: plot([fpi(prej) fpi(j)],... Daniel@0: [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ... Daniel@0: fpi(tp{i}{1}{1}(k,j)) - fpi(1)],... Daniel@0: 'kx','MarkerSize',10) Daniel@0: end Daniel@0: prej = j; Daniel@0: end Daniel@0: end Daniel@0: end Daniel@0: elseif not(isempty(pp)) && not(isempty(pp{i})) Daniel@0: hold on Daniel@0: for k = 1:length(pp{i}{1}) Daniel@0: for j = 1:length(pp{i}{1}{k}) Daniel@0: plot(fpi(k),fpi(pp{i}{1}{k}(j)) - fpi(1), ... Daniel@0: 'w+','MarkerSize',10) Daniel@0: end Daniel@0: end Daniel@0: end Daniel@0: set(gca,'YDir','normal') Daniel@0: if k == l Daniel@0: title(t) Daniel@0: end Daniel@0: if k == 1 Daniel@0: xlabel('temporal location of frame centers (in s.)') Daniel@0: end Daniel@0: if k == ceil(l/2) Daniel@0: if strcmp(m.view,'h') Daniel@0: ylabel('relative distance between compared frames (in s.)') Daniel@0: elseif strcmp(m.view,'l') Daniel@0: ylabel('temporal lag (in s.)') Daniel@0: else Daniel@0: ylabel('temporal location of frame centers (in s.)') Daniel@0: end Daniel@0: end Daniel@0: if l > 1 Daniel@0: pos = get(gca,'Position'); Daniel@0: hfig = axes('Position',[pos(1)-.05 pos(2)+pos(4)/2 .01 .01],... Daniel@0: 'Visible','off'); Daniel@0: text(0,0,num2str(cha{i}(k)),'FontSize',12,'Color','r') Daniel@0: end Daniel@0: end Daniel@0: fig = get(0,'CurrentFigure'); Daniel@0: disp(['The ',t,' related to file ',nam{i},' is displayed in Figure ',num2str(fig),'.']); Daniel@0: end Daniel@0: disp(' '); Daniel@0: drawnow