Home > marl > lib > checkparams.m

checkparams

PURPOSE ^

Verifies parameter structure and sets defaults for optional parameters

SYNOPSIS ^

function [s, flag, overridden, defaulted] = checkparams(s, defaults, required)

DESCRIPTION ^

Verifies parameter structure and sets defaults for optional parameters
  [S] = CHECKPARAMS(S, DEFAULTS, REQUIRED)
  Verifies a parameter structure for required fields and sets defaults for
  optional fields. If any required field is missing, this will be signaled
  with -1 on the FLAG. If no FLAG is required on the output, an error will
  be fired.
  
  Parameters:
   S           - the parameters structure to check
   DEFAULTS    - the default values for optional parameters, a structure
               with the same field names for parameters as those expected
               in S. Can contain nested structures. Can be an empty matrix,
               in which case no defaults are installed but the required fields
               are verified.
   REQUIRED    - the names of the required parameters, cell array of
               strings

  Note that type verifications are not performed; e.g. if a numeric is in
  place of a structure, it will be handled as a structure and as a result
  an (unaddressed) error will occur.

  Returns:
   S           - the parameters structure with the missing values replaced
               by defaults
   FLAG        - signals whether initialization finished correctly or not
   OVERRIDDEN  - fields that were explicitly set
   DEFAULTED   - fields that defaulted

  Author:      Lucian Busoniu
  Version:     1.0
  History:

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 04-Aug-2010 16:55:08 by m2html © 2005