wolffd@0: function c = mirtimes(a,b) wolffd@0: wolffd@0: d = get(a,'Data'); wolffd@0: e = get(b,'Data'); wolffd@0: f = cell(1,length(d)); wolffd@0: p = get(a,'Pos'); wolffd@0: q = get(b,'Pos'); wolffd@0: r = cell(1,length(d)); wolffd@0: l = get(a,'Name'); wolffd@0: m = get(b,'Name'); wolffd@0: n = cell(1,length(l)); wolffd@0: for i = 1:length(d) wolffd@0: f{i} = cell(1,length(d{i})); wolffd@0: for j = 1:length(d{i}) wolffd@0: pij = p{i}{j}(:,1,1); wolffd@0: qij = q{i}{j}(:,1,1); wolffd@0: pq = pij; %union(pij,qij); wolffd@0: % The sampling of the product is the sampling of the first wolffd@0: % operand. wolffd@0: dij = d{i}{j}; %interp1(pij,d{i}{j},pq); wolffd@0: eij = interp1(qij,e{i}{j},pq); wolffd@0: dij = max(dij,0); wolffd@0: eij = max(eij,0); wolffd@0: eij = eij./repmat(max(eij)+1e-16,[size(eij,1),1,1,1]); wolffd@0: % The second operand of mirtimes is scaled from 0 to 1. wolffd@0: % In this way, the range of value of the first operand is kept. wolffd@0: f{i}{j} = dij.*eij; wolffd@0: [x y] = find(isnan(f{i}{j})); wolffd@0: x = unique(x); wolffd@0: pq(x) = []; wolffd@0: f{i}{j}(x,:) = []; wolffd@0: r{i}{j} = repmat(pq,[1 size(p{i}{j},2) size(p{i}{j},3)]); wolffd@0: end wolffd@0: if strcmpi(l{i},m{i}) wolffd@0: n{i} = l{i}; wolffd@0: else wolffd@0: n{i} = [l{i} '*' m{i}]; wolffd@0: end wolffd@0: end wolffd@0: c = set(a,'Pos',r,'Data',f,'Name',n,... wolffd@0: 'Title',[get(a,'Title') ' * ' get(b,'Title')]);