0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function obj = buildObject(mainfig)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % get model type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 h = findobj(mainfig.handle, 'Tag', 'ModelTypeSelect');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 models = get(h, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 modelType = models{get(h, 'Value')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % get model name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 h = findobj(mainfig.handle, 'Tag', 'ModelSelect');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 models = get(h, 'String');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 model = models{get(h, 'Value')};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % get parameters
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 h = findobj(mainfig.handle, 'Tag', 'MODELVIEWERparamspanel');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 pl = modelViewer.getParamsFromPanel(h);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 % Pass to constructor
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 obj = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 switch modelType
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 case 'ao'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 pl = combine(plist('built-in', model), pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 obj = feval('ao', pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 case 'ssm'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 pl = combine(plist('built-in', model), pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 obj = feval('ssm', pl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 error('model type %s is currently unsupported', modelType);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 end
|