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