view m-toolbox/classes/@plist/getDefaultAxisPlist.m @ 18:947e2ff4b1b9 database-connection-manager

Update plist.FROM_REPOSITORY_PLIST and plist.TO_REPOSITORY_PLIST
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% GETDEFAULTAXISPLIST returns the default plist for the axis key based on
% the input set.
% 
% CALL:
%          pl = plist.getDefaultAxisPlist(set)
% 
% Supported sets: '1D', '2D', '3D'
% 
% VERSION $Id: getDefaultAxisPlist.m,v 1.2 2011/04/19 16:20:21 ingo Exp $
% 
function plout = getDefaultAxisPlist(varargin)
  
  if nargin == 0
    set = '';
  else
    set = varargin{1};
    
    if ~ischar(varargin{1})
      error('Incorrect usage: the set needs to be a string.');
    end
  end
  
%   persistent pl;
%   persistent lastset;
%   if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
    pl = buildplist(set);
%     lastset = set;
%   end
  plout = pl;
  
end

function pl = buildplist(set)

  switch set
    case '1D'
      pl = plist.AXIS_1D_PLIST;
    case '2D'
      pl = plist.AXIS_2D_PLIST;
    case '3D'
      pl = plist.AXIS_3D_PLIST;
    case ''
      pl = plist.AXIS_3D_PLIST;
    otherwise
      error('Unsupported set for default axis plist [%s]', set);
  end
  
end