diff m-toolbox/classes/@modelViewer/buildObject.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@modelViewer/buildObject.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,33 @@
+function obj = buildObject(mainfig)
+  
+    % get model type
+  h = findobj(mainfig.handle, 'Tag', 'ModelTypeSelect');
+  models = get(h, 'String');
+  modelType = models{get(h, 'Value')};
+  
+  % get model name
+  h = findobj(mainfig.handle, 'Tag', 'ModelSelect');
+  models = get(h, 'String');
+  model = models{get(h, 'Value')};
+  
+  % get parameters
+  h = findobj(mainfig.handle, 'Tag', 'MODELVIEWERparamspanel');  
+  pl = modelViewer.getParamsFromPanel(h);
+  
+  % Pass to constructor
+  obj = [];
+  switch modelType
+    case 'ao'
+      
+      pl = combine(plist('built-in', model), pl);      
+      obj = feval('ao', pl);
+
+    case 'ssm'
+      
+      pl = combine(plist('built-in', model), pl);      
+      obj = feval('ssm', pl);
+      
+    otherwise
+      error('model type %s is currently unsupported', modelType);
+  end
+end