view m-toolbox/classes/@plist/getDefaultAxisPlist.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 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