comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function c = mirtimes(a,b)
2
3 d = get(a,'Data');
4 e = get(b,'Data');
5 f = cell(1,length(d));
6 p = get(a,'Pos');
7 q = get(b,'Pos');
8 r = cell(1,length(d));
9 l = get(a,'Name');
10 m = get(b,'Name');
11 n = cell(1,length(l));
12 for i = 1:length(d)
13 f{i} = cell(1,length(d{i}));
14 for j = 1:length(d{i})
15 pij = p{i}{j}(:,1,1);
16 qij = q{i}{j}(:,1,1);
17 pq = pij; %union(pij,qij);
18 % The sampling of the product is the sampling of the first
19 % operand.
20 dij = d{i}{j}; %interp1(pij,d{i}{j},pq);
21 eij = interp1(qij,e{i}{j},pq);
22 dij = max(dij,0);
23 eij = max(eij,0);
24 eij = eij./repmat(max(eij)+1e-16,[size(eij,1),1,1,1]);
25 % The second operand of mirtimes is scaled from 0 to 1.
26 % In this way, the range of value of the first operand is kept.
27 f{i}{j} = dij.*eij;
28 [x y] = find(isnan(f{i}{j}));
29 x = unique(x);
30 pq(x) = [];
31 f{i}{j}(x,:) = [];
32 r{i}{j} = repmat(pq,[1 size(p{i}{j},2) size(p{i}{j},3)]);
33 end
34 if strcmpi(l{i},m{i})
35 n{i} = l{i};
36 else
37 n{i} = [l{i} '*' m{i}];
38 end
39 end
40 c = set(a,'Pos',r,'Data',f,'Name',n,...
41 'Title',[get(a,'Title') ' * ' get(b,'Title')]);