annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirdata/combine.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 = combine(varargin)
Daniel@0 2
Daniel@0 3 c = varargin{1};
Daniel@0 4 l = length(varargin);
Daniel@0 5 p = cell(1,l);
Daniel@0 6 ch = cell(1,l);
Daniel@0 7 d = cell(1,l);
Daniel@0 8 fp = cell(1,l);
Daniel@0 9 sr = cell(1,l);
Daniel@0 10 n = cell(1,l);
Daniel@0 11 la = cell(1,l);
Daniel@0 12 cl = cell(1,l);
Daniel@0 13 pp = cell(1,l);
Daniel@0 14 pm = cell(1,l);
Daniel@0 15 pv = cell(1,l);
Daniel@0 16 ppp = cell(1,l);
Daniel@0 17 ppv = cell(1,l);
Daniel@0 18 tp = cell(1,l);
Daniel@0 19 tv = cell(1,l);
Daniel@0 20 tpp = cell(1,l);
Daniel@0 21 tpv = cell(1,l);
Daniel@0 22 ap = cell(1,l);
Daniel@0 23 rp = cell(1,l);
Daniel@0 24 if isa(c,'temporal')
Daniel@0 25 nb = cell(1,l);
Daniel@0 26 end
Daniel@0 27 if isa(c,'mirscalar')
Daniel@0 28 m = cell(1,l);
Daniel@0 29 end
Daniel@0 30 if isa(c,'miremotion')
Daniel@0 31 dd = cell(1,l);
Daniel@0 32 cd = cell(1,l);
Daniel@0 33 end
Daniel@0 34 for i = 1:l
Daniel@0 35 argin = varargin{i};
Daniel@0 36 p{i} = getargin(argin,'Pos');
Daniel@0 37 ch{i} = getargin(argin,'Channels');
Daniel@0 38 d{i} = getargin(argin,'Data');
Daniel@0 39 fp{i} = getargin(argin,'FramePos');
Daniel@0 40 sr{i} = getargin(argin,'Sampling');
Daniel@0 41 nb{i} = getargin(argin,'NBits');
Daniel@0 42 n{i} = getargin(argin,'Name');
Daniel@0 43 la{i} = getargin(argin,'Label');
Daniel@0 44 cl{i} = getargin(argin,'Clusters');
Daniel@0 45 pp{i} = getargin(argin,'PeakPos');
Daniel@0 46 pm{i} = getargin(argin,'PeakMode');
Daniel@0 47 pv{i} = getargin(argin,'PeakVal');
Daniel@0 48 ppp{i} = getargin(argin,'PeakPrecisePos');
Daniel@0 49 ppv{i} = getargin(argin,'PeakPreciseVal');
Daniel@0 50 tp{i} = getargin(argin,'TrackPos');
Daniel@0 51 tv{i} = getargin(argin,'TrackVal');
Daniel@0 52 tpp{i} = getargin(argin,'TrackPrecisePos');
Daniel@0 53 tpv{i} = getargin(argin,'TrackPreciseVal');
Daniel@0 54 ap{i} = getargin(argin,'AttackPos');
Daniel@0 55 rp{i} = getargin(argin,'ReleasePos');
Daniel@0 56 if isa(c,'temporal')
Daniel@0 57 ct = getargin(argin,'Centered');
Daniel@0 58 nb{i} = getargin(argin,'NBits');
Daniel@0 59 end
Daniel@0 60 if isa(c,'mirscalar')
Daniel@0 61 m{i} = getargin(argin,'Mode');
Daniel@0 62 end
Daniel@0 63 if isa(c,'miremotion')
Daniel@0 64 dd{i} = getargin(argin,'DimData');
Daniel@0 65 cd{i} = getargin(argin,'ClassData');
Daniel@0 66 end
Daniel@0 67 end
Daniel@0 68 c = set(c,'Pos',p,'Data',d,'FramePos',fp,'Channels',ch,...
Daniel@0 69 'Sampling',sr,'NBits',nb,'Name',n,'Label',la,...
Daniel@0 70 'Clusters',cl,'PeakPos',pp,'PeakMode',pm,'PeakVal',pv,...
Daniel@0 71 'PeakPrecisePos',ppp,'PeakPreciseVal',ppv,...
Daniel@0 72 'TrackPos',tp,'TrackVal',tv,...
Daniel@0 73 'TrackPrecisePos',tpp,'TrackPreciseVal',tpv,...
Daniel@0 74 'AttackPos',ap,'ReleasePos',rp);
Daniel@0 75 if isa(c,'temporal')
Daniel@0 76 c = set(c,'Centered',ct,'NBits',nb);
Daniel@0 77 end
Daniel@0 78 if isa(c,'mirscalar')
Daniel@0 79 c = set(c,'Mode',m);
Daniel@0 80 end
Daniel@0 81 if isa(c,'miremotion')
Daniel@0 82 c = set(c,'DimData',dd,'ClassData',cd);
Daniel@0 83 end
Daniel@0 84
Daniel@0 85
Daniel@0 86 function y = getargin(argin,field)
Daniel@0 87 yi = get(argin,field);
Daniel@0 88 if isempty(yi) || ischar(yi)
Daniel@0 89 y = yi;
Daniel@0 90 else
Daniel@0 91 y = yi{1};
Daniel@0 92 end