Home > lattice > element_creation > private > decodeatargs.m

decodeatargs

PURPOSE ^

DECODEATARGS separates arguments and resources

SYNOPSIS ^

function [rsrc,varargout] = decodeatargs(default_values,args)

DESCRIPTION ^

DECODEATARGS separates arguments and resources

  [RSRC,ARGS]=decodeatargs(DEFARGS,ARGLIST)

  INPUTS
    1. DEFARGS - Values per default if not specify for mandatory
                 argument
    2. ARGS    - Other arugments

  OUPUTS
    1. rsrc      - Mandatory arguments
    2. varargout - Optional arguments

  NOTES
    1. DEFARGS must have length >= 2

  See also getoption, getflag

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [rsrc,varargout] = decodeatargs(default_values,args)
0002 %DECODEATARGS separates arguments and resources
0003 %
0004 %  [RSRC,ARGS]=decodeatargs(DEFARGS,ARGLIST)
0005 %
0006 %  INPUTS
0007 %    1. DEFARGS - Values per default if not specify for mandatory
0008 %                 argument
0009 %    2. ARGS    - Other arugments
0010 %
0011 %  OUPUTS
0012 %    1. rsrc      - Mandatory arguments
0013 %    2. varargout - Optional arguments
0014 %
0015 %  NOTES
0016 %    1. DEFARGS must have length >= 2
0017 %
0018 %  See also getoption, getflag
0019 
0020 % function to get the first string which is after the PassMethod
0021 nopass    = @(arg) ischar(arg) && ~isempty(arg) && isempty(regexp(arg,'.*Pass$','once'));
0022 % get index of first optional char Argument
0023 chararg   = find(cellfun(nopass,[args {'x'}]),1); 
0024 % get all optional argument (ressources)
0025 rsrc      = args(chararg:end);
0026 % output mandatory argument
0027 varargout = parseargs(default_values,args(1:chararg-1));
0028 
0029 end

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005