annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/mirtimes.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function c = mirtimes(a,b)
wolffd@0 2
wolffd@0 3 d = get(a,'Data');
wolffd@0 4 e = get(b,'Data');
wolffd@0 5 f = cell(1,length(d));
wolffd@0 6 p = get(a,'Pos');
wolffd@0 7 q = get(b,'Pos');
wolffd@0 8 r = cell(1,length(d));
wolffd@0 9 l = get(a,'Name');
wolffd@0 10 m = get(b,'Name');
wolffd@0 11 n = cell(1,length(l));
wolffd@0 12 for i = 1:length(d)
wolffd@0 13 f{i} = cell(1,length(d{i}));
wolffd@0 14 for j = 1:length(d{i})
wolffd@0 15 pij = p{i}{j}(:,1,1);
wolffd@0 16 qij = q{i}{j}(:,1,1);
wolffd@0 17 pq = pij; %union(pij,qij);
wolffd@0 18 % The sampling of the product is the sampling of the first
wolffd@0 19 % operand.
wolffd@0 20 dij = d{i}{j}; %interp1(pij,d{i}{j},pq);
wolffd@0 21 eij = interp1(qij,e{i}{j},pq);
wolffd@0 22 dij = max(dij,0);
wolffd@0 23 eij = max(eij,0);
wolffd@0 24 eij = eij./repmat(max(eij)+1e-16,[size(eij,1),1,1,1]);
wolffd@0 25 % The second operand of mirtimes is scaled from 0 to 1.
wolffd@0 26 % In this way, the range of value of the first operand is kept.
wolffd@0 27 f{i}{j} = dij.*eij;
wolffd@0 28 [x y] = find(isnan(f{i}{j}));
wolffd@0 29 x = unique(x);
wolffd@0 30 pq(x) = [];
wolffd@0 31 f{i}{j}(x,:) = [];
wolffd@0 32 r{i}{j} = repmat(pq,[1 size(p{i}{j},2) size(p{i}{j},3)]);
wolffd@0 33 end
wolffd@0 34 if strcmpi(l{i},m{i})
wolffd@0 35 n{i} = l{i};
wolffd@0 36 else
wolffd@0 37 n{i} = [l{i} '*' m{i}];
wolffd@0 38 end
wolffd@0 39 end
wolffd@0 40 c = set(a,'Pos',r,'Data',f,'Name',n,...
wolffd@0 41 'Title',[get(a,'Title') ' * ' get(b,'Title')]);