Mercurial > hg > ltpda
comparison m-toolbox/classes/@specwin/fromStruct.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 % FROMSTRUCT creates from a structure a SPECWIN object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: fromStruct | |
5 % | |
6 % DESCRIPTION: Creates from a structure a SPECWIN object. | |
7 % | |
8 % CALL: obj = fromStruct(obj, struct) | |
9 % | |
10 % VERSION: $Id: fromStruct.m,v 1.6 2011/05/24 14:42:31 ingo Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function objs = fromStruct(objs, obj_struct) | |
15 | |
16 % Get the class name of the object. | |
17 cn = class(objs); | |
18 | |
19 % Define function name for updating the structure | |
20 fcnName = ([cn '.update_struct']); | |
21 | |
22 % Initialize output objects | |
23 objs = feval([cn '.initObjectWithSize'], size(obj_struct, 1), size(obj_struct, 2)); | |
24 | |
25 % Update structure (if necessary) | |
26 for kk = 1:numel(obj_struct) | |
27 | |
28 % Get structure version | |
29 if isfield(obj_struct, 'tbxver') | |
30 tbxVer = obj_struct(kk).tbxver; | |
31 else | |
32 tbxVer = '1.0'; | |
33 end | |
34 % Update structure | |
35 up_struct = feval(fcnName, obj_struct(kk), tbxVer); | |
36 | |
37 % Call super-class | |
38 objs(kk) = fromStruct@ltpda_nuo(objs(kk), up_struct); | |
39 | |
40 % Set 'type' object | |
41 if isfield(up_struct, 'type') | |
42 objs(kk).type = up_struct.type; | |
43 end | |
44 | |
45 % Set 'alpha' object | |
46 if isfield(up_struct, 'alpha') | |
47 objs(kk).alpha = up_struct.alpha; | |
48 end | |
49 | |
50 % Set 'psll' object | |
51 if isfield(up_struct, 'psll') | |
52 objs(kk).psll = up_struct.psll; | |
53 end | |
54 | |
55 % Set 'rov' object | |
56 if isfield(up_struct, 'rov') | |
57 objs(kk).rov = up_struct.rov; | |
58 end | |
59 | |
60 % Set 'nenbw' object | |
61 if isfield(up_struct, 'nenbw') | |
62 objs(kk).nenbw = up_struct.nenbw; | |
63 end | |
64 | |
65 % Set 'w3db' object | |
66 if isfield(up_struct, 'w3db') | |
67 objs(kk).w3db = up_struct.w3db; | |
68 end | |
69 | |
70 % Set 'flatness' object | |
71 if isfield(up_struct, 'flatness') | |
72 objs(kk).flatness = up_struct.flatness; | |
73 end | |
74 | |
75 % Set 'levelorder' object | |
76 if isfield(up_struct, 'levelorder') | |
77 objs(kk).levelorder = up_struct.levelorder; | |
78 end | |
79 | |
80 % Set 'skip' object | |
81 if isfield(up_struct, 'skip') | |
82 objs(kk).skip = up_struct.skip; | |
83 end | |
84 | |
85 % Set 'len' object | |
86 if isfield(up_struct, 'len') | |
87 objs(kk).len = up_struct.len; | |
88 elseif isfield(up_struct, 'win') | |
89 objs(kk).len = length(up_struct.win); | |
90 end | |
91 | |
92 % % Set 'ws' object | |
93 % if isfield(up_struct, 'ws') | |
94 % objs(kk).ws = up_struct.ws; | |
95 % end | |
96 % | |
97 % % Set 'ws2' object | |
98 % if isfield(up_struct, 'ws2') | |
99 % objs(kk).ws2 = up_struct.ws2; | |
100 % end | |
101 % | |
102 % % Set 'win' object | |
103 % if isfield(up_struct, 'win') | |
104 % objs(kk).win = up_struct.win; | |
105 % end | |
106 | |
107 end | |
108 | |
109 end | |
110 |