view m-toolbox/classes/@modelViewer/getParamsFromPanel.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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