No BSD License  

Highlights from
ParseVarArgIn

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 2.17 KB File ID: #8123

ParseVarArgIn

by Michael Robbins

 

27 Jul 2005 (Updated 27 Jul 2005)

parses a parameter list. Given a set of property names, it assigns the appropriate values to variab

| Watch this File

File Information
Description

PARSEVARARGIN parses a parameter list. Given a set of property names, PARSEVARARGIN assigns the appropriate values to variables. The variables get the name of the property. For instance, if you call a function, foo:
 
     foo(in,'Color','green','Charm',5);
 
  and in foo, you call PARSEVARARGIN:
 
     ParseVarargin({'Color','Charm','Strangeness'});
 
  PARSEVARARGIN will create a variable Color, with the value 'green', a
  variable Charm, with the value 5, and a variable Strangness, with the
  value NaN.
 
  PARSEVARARGIN will do type checking if you provide types and it will
  assign NaN to parameters that are not specified.
 
   Example
     clear all;
     W = 10;
     in = double(rand(10,W)>.5);
     XLabel = cellstr(datestr(today-[W:-1:1],'mm/dd/yy'));
     Title = 'Exercise Schedule Checkerboard';
     Name = 'HeartRateAnalyser';
     varargin = {in,'XLabel',XLabel,'Title',Title,'Name',Name};
     Prop = {'XLabel','YLabel','Title','Name'};
     PClass = {'cell','cell','char','char'};
     clear W in Xlabel Title
     who
     ParseVarargin(varargin,Prop,PClass);
     clear varargin Prop PClass
     who
     Name
     Title
     XLabel
     YLabel
 
 
  See also varargout nargin nargout inputname function lists paren
           CatOrSplitFiles CheckerboardPlot varargin nargin
           assignin evalin

 
  Key words varargout nargin nargout inputname function lists paren CatOrSplitFiles CheckerboardPlot parameter workspace assign input output arguments
 
 
 
  It's not fancy, but it works

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
structures Michael Robbins 22 Oct 2008 07:54:18
cell arrays Michael Robbins 22 Oct 2008 07:54:18
varargout Michael Robbins 22 Oct 2008 07:54:18
nargin Michael Robbins 22 Oct 2008 07:54:18
nargout Michael Robbins 22 Oct 2008 07:54:18
inputname Michael Robbins 22 Oct 2008 07:54:18
function Michael Robbins 22 Oct 2008 07:54:18
lists Michael Robbins 22 Oct 2008 07:54:18
paren Michael Robbins 22 Oct 2008 07:54:18

Contact us at files@mathworks.com