view m-toolbox/m/helper/keys.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

function varargout = keys(varargin)
  
  className = varargin{1};
  if nargin > 1
    methodName = varargin{2}
  else
    methodName = className;
  end
  
  cmd = sprintf('%s.getInfo(''%s'')', className, methodName);
  ii = eval(cmd);
  
  out = '';
  for kk=1:numel(ii.sets)
    set = ii.sets{kk};
    out = [out repmat('-', 1, length(set))];
    out = [out sprintf('\n')];
    out = [out sprintf('%s\n', set)];
    out = [out repmat('-', 1, length(set))];
    out = [out sprintf('\n')];
    
    pl = ii.plists(kk);
    keys = pl.getKeys();
    keyLine = '';
    for ll=1:numel(keys)
      key = keys{ll};
      keyLine = [keyLine key];
      if length(keyLine)>100
        keyLine = [keyLine sprintf('\n')];
        out = [out keyLine];
        keyLine = '';
      else
        if ll < numel(keys)
          keyLine = [keyLine ', '];
        end
      end
    end
    out = [out keyLine sprintf('\n\n')];
    
  end
  
  disp(out);
  
  if nargout > 0
    varargout{1} = out;
  end
  
end