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