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

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function c = mirtimes(a,b)
Daniel@0 2
Daniel@0 3 d = get(a,'Data');
Daniel@0 4 e = get(b,'Data');
Daniel@0 5 f = cell(1,length(d));
Daniel@0 6 p = get(a,'Pos');
Daniel@0 7 q = get(b,'Pos');
Daniel@0 8 r = cell(1,length(d));
Daniel@0 9 l = get(a,'Name');
Daniel@0 10 m = get(b,'Name');
Daniel@0 11 n = cell(1,length(l));
Daniel@0 12 for i = 1:length(d)
Daniel@0 13 f{i} = cell(1,length(d{i}));
Daniel@0 14 for j = 1:length(d{i})
Daniel@0 15 pij = p{i}{j}(:,1,1);
Daniel@0 16 qij = q{i}{j}(:,1,1);
Daniel@0 17 pq = pij; %union(pij,qij);
Daniel@0 18 % The sampling of the product is the sampling of the first
Daniel@0 19 % operand.
Daniel@0 20 dij = d{i}{j}; %interp1(pij,d{i}{j},pq);
Daniel@0 21 eij = interp1(qij,e{i}{j},pq);
Daniel@0 22 dij = max(dij,0);
Daniel@0 23 eij = max(eij,0);
Daniel@0 24 eij = eij./repmat(max(eij)+1e-16,[size(eij,1),1,1,1]);
Daniel@0 25 % The second operand of mirtimes is scaled from 0 to 1.
Daniel@0 26 % In this way, the range of value of the first operand is kept.
Daniel@0 27 f{i}{j} = dij.*eij;
Daniel@0 28 [x y] = find(isnan(f{i}{j}));
Daniel@0 29 x = unique(x);
Daniel@0 30 pq(x) = [];
Daniel@0 31 f{i}{j}(x,:) = [];
Daniel@0 32 r{i}{j} = repmat(pq,[1 size(p{i}{j},2) size(p{i}{j},3)]);
Daniel@0 33 end
Daniel@0 34 if strcmpi(l{i},m{i})
Daniel@0 35 n{i} = l{i};
Daniel@0 36 else
Daniel@0 37 n{i} = [l{i} '*' m{i}];
Daniel@0 38 end
Daniel@0 39 end
Daniel@0 40 c = set(a,'Pos',r,'Data',f,'Name',n,...
Daniel@0 41 'Title',[get(a,'Title') ' * ' get(b,'Title')]);