diff m-toolbox/m/gui/ltpdv/callbacks/ltpdv_get_params_from_panel.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/m/gui/ltpdv/callbacks/ltpdv_get_params_from_panel.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,63 @@
+% LTPDV_GET_PARAMS_FROM_PANEL get a plist from the parameters on a
+% parameters panel
+% 
+% M Hewitson 26-08-08
+% 
+% $Id: ltpdv_get_params_from_panel.m,v 1.1 2008/09/02 07:51:47 hewitson Exp $
+% 
+function pl = ltpdv_get_params_from_panel(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);
+        otherwise
+          error(['### Unsupported value class: ' valclass]);
+      end
+
+      % Add to plist
+      pl = append(pl, key, val);
+    end
+  end
+  
+end
\ No newline at end of file