Library Function li_namval

function varargout = li_namval(cArgs, cDef)

Checks a list of arguments passed in <cArgs> for name-value pairs as defined in <cDef> and returns the results for all definitions. <cArgs> must be a one-dimensional cell array with an even element count. Elements of <cArgs> with an uneven index are interpreted as names, each following element as associated value. <cDef> must be a cell array with two columns and one line per return value definition. The first column of every row defines the name, the second the default value. The number of output arguments must match the number of lines in <cDef>. The value associated to the first occurence of the defined name is passed in respective position, if no occurence was detected, the default value is passed back. If one more output argument is present than required by the number of definitions passed in <cDef>, a struct with additional search information will be provided. It will contain a logical array as member <bFound> containing for each variable definition the value true if the variable was found in the input and false otherwise. A second member <cUnused> will contain all the name-value pairs found in <cArgs> that do not occur in <cDef>.