time | Calls | line |
---|
| | 880 | function [varargout] = getargs(pnames,dflts,varargin)
|
| | 881 |
|
| | 882 | % Initialize some variables
|
< 0.001 | 1 | 883 | nparams = length(pnames);
|
| 1 | 884 | varargout = dflts;
|
< 0.001 | 1 | 885 | unrecog = {};
|
< 0.001 | 1 | 886 | nargs = length(varargin);
|
| | 887 |
|
| | 888 | % Must have name/value pairs
|
< 0.001 | 1 | 889 | if mod(nargs,2)~=0
|
| | 890 | error(message('MATLAB:RandStream:WrongNumberArgs'));
|
| 1 | 891 | else
|
| | 892 | % Process name/value pairs
|
< 0.001 | 1 | 893 | for j=1:2:nargs
|
< 0.001 | 1 | 894 | pname = convertStringsToChars(varargin{j});
|
| 1 | 895 | if ~ischar(pname)
|
| | 896 | error(message('MATLAB:RandStream:BadParamName'));
|
| | 897 | end
|
< 0.001 | 1 | 898 | i = find(strncmpi(pname,pnames,length(pname)));
|
< 0.001 | 1 | 899 | if isscalar(i)
|
< 0.001 | 1 | 900 | varargout{i} = convertStringsToChars(varargin{j+1});
|
| | 901 | elseif isempty(i)
|
| | 902 | error(message('MATLAB:RandStream:UnrecognizedParamName',pname));
|
| | 903 | else
|
| | 904 | error(message('MATLAB:RandStream:AmbiguousParamName',pname));
|
| | 905 | end
|
< 0.001 | 1 | 906 | end
|
| 1 | 907 | end
|
| | 908 |
|
< 0.001 | 1 | 909 | varargout{nparams+1} = unrecog;
|
| | 910 |
|
< 0.001 | 1 | 911 | end
|
Other subfunctions in this file are not included in this listing.