Highlights from
ArgUtils

  • ArgUtils.assignArgs( defa...
    ASSIGNARGS Assign input and default values to named target variables
  • ArgUtils.assignVars( defa...
    ASSIGNVARS Assign input and default values to a sequence of target variables
  • ArgUtils.tostruct(varargin)
    Because MATLAB's struct API is a disaster
  • ArgUtils.unstruct(s)
    Unpack a struct into a cell-array of name-value pairs.
  • nameDoesMatch(name, list)
  • startsWith(str, prefix)
  • stripPrefix(str, prefix)
  • test()
    string matching is case-insensitive, allows abbreviation
  • updateFieldValues(default...
    'assigned' is a reference to a java hash set
  • ArgUtils.ArgUtils
  • View all files

4.0

4.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 10.6 KB File ID: #42205

ArgUtils

by

 

12 Jun 2013 (Updated )

Argument parsing utilities

| Watch this File

File Information
Description

Useful for assigning defaults to functions that use varargin or structs of input parameters (alternative to inputParser).

See examples (and latest updates) on the github repository:
https://github.com/nvictus/ArgUtils

- Use ArgUtils.assignVars() to assign variables sequentially
- Use ArgUtils.assignArgs() to assign named variables: it works on either struct input or cell-array input containing a sequence of values followed by keyword arguments (name-value pairs) in any order.

Keywords are matched using MATLAB's string validator, so matching is case-insensitive and abbreviated keywords are acceptable as long as they can be matched unambiguously. There are also options to specify:
- required input parameters
- prefixes on keywords to prevent name collisions with string values

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
12 Jun 2013 Stephen McNeill  
Updates
17 Jun 2013

version 1.0 - stable

18 Jun 2013

version 1.1 - fixed minor bug with prefixes, moved nonpublic functions to private folder

24 Jun 2013

name on license

22 Apr 2014

Connected to github

Contact us