comparison toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirdata/plus.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 = plus(a,b)
2
3 d = get(a,'Data');
4 f = cell(1,length(d));
5 n = get(a,'Name');
6 t = get(a,'Title');
7
8 if isa(b,'mirdata')
9 e = get(b,'Data');
10 m = get(b,'Name');
11 u = get(b,'Title');
12 if not(isa(a,'miraudio'))
13 t = [t,' + ',get(b,'Title')];
14 end
15 else
16 e = {{b}};
17 m = {num2str(b)};
18 t = [t,' + ',num2str(b)];
19 end
20
21 for i = 1:length(d)
22 f{i} = cell(1,length(d{i}));
23 for j = 1:length(d{i})
24 ld = size(d{i}{j},1);
25 le = size(e{i}{j},1);
26 if ld > le
27 f{i}{j} = d{i}{j} + [e{i}{j};zeros(ld-le,size(e,2),size(e,3))];
28 elseif ld < le
29 f{i}{j} = [d{i}{j};zeros(le-ld,size(d,2),size(d,3))] + e{i}{j};
30 else
31 f{i}{j} = d{i}{j} + e{i}{j};
32 end
33 end
34 if isa(a,'miraudio')
35 n{i} = [n{i} '+' m{i}];
36 end
37 end
38 c = set(a,'Data',f,'Name',n,'Title',t);