time | calls | line |
---|
| | 1 | function [regargs, proppairs]=parseparams(args)
|
| | 2 | %PARSEPARAMS Finds first string argument.
|
| | 3 | % [REG, PROP]=PARSEPARAMS(ARGS) takes cell array ARGS and
|
| | 4 | % separates it into two argument sets:
|
| | 5 | % REG being all arguments up to, but excluding, the
|
| | 6 | % first string argument encountered in ARGS.
|
| | 7 | % PROP contains all other arguments after, and including,
|
| | 8 | % the first string argument encountered.
|
| | 9 | %
|
| | 10 | % PARSEPARAMS is intended to isolate possible property
|
| | 11 | % value pairs in functions using VARARGIN as the input
|
| | 12 | % argument.
|
| | 13 |
|
| | 14 | % Chris Portal 2-17-98
|
| | 15 | % Copyright 1984-2002 The MathWorks, Inc.
|
| | 16 |
|
| 37 | 17 | charsrch=[];
|
| | 18 |
|
| 37 | 19 | for i=1:length(args),
|
| 222 | 20 | charsrch=[charsrch ischar(args{i})];
|
| 222 | 21 | end
|
| | 22 |
|
| 37 | 23 | charindx=find(charsrch);
|
| | 24 |
|
| 37 | 25 | if isempty(charindx),
|
| | 26 | regargs=args;
|
| | 27 | proppairs=args(1:0);
|
| 37 | 28 | else
|
| 37 | 29 | regargs=args(1:charindx(1)-1);
|
| 37 | 30 | proppairs=args(charindx(1):end);
|
| 37 | 31 | end
|