0001 function b = resample(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 ALGONAME = mfilename;
0014 VERSION = '$Id: resample.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $';
0015
0016
0017 invars = {};
0018 as = [];
0019 pl = [];
0020 for j=1:nargin
0021 a = varargin{j};
0022 if isa(a, 'ao')
0023 d = a.data;
0024 if isa(d, 'tsdata')
0025 as = [as a];
0026 invars = [invars cellstr(inputname(j))];
0027 else
0028 warning('!!! ignoring non-time-series AO.');
0029 end
0030 end
0031 if isa(a, 'plist')
0032 pl = a;
0033 end
0034 end
0035
0036 if isempty(pl)
0037 error('### Please give a plist with a parameter ''fsout''.');
0038 end
0039
0040 fsout = find(pl, 'fsout');
0041 if isempty(fsout)
0042 error('### Please give a plist with a parameter ''fsout''.');
0043 end
0044
0045 na = length(as);
0046 for j=1:na
0047
0048 a = as(j);
0049 d = a.data;
0050 x = d.x;
0051 fs = d.fs;
0052
0053
0054 y = resample(x, fsout, fs);
0055
0056
0057 do = tsdata(y, fsout);
0058
0059
0060
0061
0062 h = history(ALGONAME, VERSION, pl, a.hist);
0063 h = set(h, 'invars', invars);
0064
0065
0066 if isempty(char(invars{1}))
0067 n1 = a.name;
0068 else
0069 n1 = char(invars{1});
0070 end
0071
0072
0073 b = ao(do, h);
0074 b = set(b, 'name', sprintf('resample(%s)', n1));
0075
0076 end
0077
0078
0079