diff m-toolbox/classes/@modelViewer/getParamsFromPanel.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/getParamsFromPanel.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,65 @@
+% GETPARAMSFROMPANEL get a plist from the parameters on a
+% parameters panel
+% 
+% M Hewitson 30-11-08
+% 
+% $Id: getParamsFromPanel.m,v 1.3 2011/04/08 08:56:34 hewitson Exp $
+% 
+function pl = getParamsFromPanel(parampanh)
+  
+  
+  % Get params
+  pancomps  = getappdata(parampanh, 'pancomps');
+
+  % loop over params
+  pl = plist();
+  for j=1:size(pancomps,1)
+
+    % handles
+    keyf = pancomps{j,1};
+    valf = pancomps{j,2};
+    actf = pancomps{j,3};
+
+    % Get activate status
+    if get(actf, 'Value')
+      % Get key name
+      key = get(keyf, 'String');
+
+      % Get param value
+      valclass = getappdata(valf, 'valClass');
+
+      switch valclass
+        case 'char'
+          val = get(valf, 'String');
+        case 'double'
+          val = get(valf, 'String');
+          try
+            val = eval(val);
+          end
+        case 'sym'
+          val = get(valf, 'String');
+          val = sym(val);
+        case 'specwin'
+          strs = get(valf, 'String');
+          idx  = get(valf, 'Value');
+          val  = strs{idx};
+          if strcmp(val, 'Kaiser')
+            val = specwin(val, 10, 150);
+          else
+            val = specwin(val, 10);
+          end
+        case 'time'
+          val = get(valf, 'String');
+          val = time(val);
+        case 'logical'
+          val = eval(get(valf, 'String'));
+        otherwise
+          error(['### Unsupported value class: ' valclass]);
+      end
+
+      % Add to plist
+      pl = append(pl, key, val);
+    end
+  end
+  
+end