Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/fromSpecWin.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % FROMSPECWIN Construct an ao from a Spectral window | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: fromSpecWin | |
5 % | |
6 % DESCRIPTION: Construct an ao from a Spectral window | |
7 % | |
8 % CALL: a = fromSpecWin(a, win) | |
9 % | |
10 % PARAMETER: win: Spectral window object | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 function a = fromSpecWin(a, pli) | |
14 | |
15 VERSION = '$Id: fromSpecWin.m,v 1.21 2011/08/15 06:50:45 hewitson Exp $'; | |
16 | |
17 % get AO info | |
18 ii = ao.getInfo('ao', 'From Window'); | |
19 | |
20 % Set the method version string in the minfo object | |
21 ii.setMversion([VERSION '-->' ii.mversion]); | |
22 | |
23 % If the user input a specwin object, construct an appropriate plist | |
24 if isa(pli, 'specwin') | |
25 pli = toPlist(pli); | |
26 end | |
27 | |
28 % If the 'win' value in the input plist is a specwin object, expand it in | |
29 % to plist keys | |
30 if isa(pli.find('win'), 'specwin') | |
31 win = pli.find('win'); | |
32 pli.remove('win'); | |
33 pli.append(toPlist(win)); | |
34 end | |
35 | |
36 % Apply defaults | |
37 pl = applyDefaults(ii.plists, pli); | |
38 win = find(pl, 'win'); | |
39 | |
40 if ischar(win) | |
41 len = pl.find('length'); | |
42 switch lower(win) | |
43 case 'kaiser' | |
44 psll = pl.find('psll'); | |
45 win = specwin(win, len, psll); | |
46 case 'levelledhanning' | |
47 levelorder = pl.find('levelorder'); | |
48 win = specwin(win, len, levelorder); | |
49 otherwise | |
50 win = specwin(win, len); | |
51 end | |
52 pl.pset('win', win.type); | |
53 else | |
54 % we have a specwin and we just use the values | |
55 end | |
56 | |
57 % Make a cdata object | |
58 a.data = cdata(win.win); | |
59 if isempty(pl.find('name')) | |
60 pl.pset('name', sprintf('ao(%s)', win.type)); | |
61 end | |
62 | |
63 % Add history | |
64 a.addHistory(ii, pl, [], []); | |
65 | |
66 % Set Yunits | |
67 a.setYunits(pl.find('yunits')); | |
68 | |
69 % Set object properties from plist | |
70 a.setObjectProperties(pl); | |
71 | |
72 end | |
73 | |
74 |