time | Calls | line |
---|
| | 1 | function [errorcode,varargout] = distchck(nparms,varargin)
|
| | 2 | %DISTCHCK Checks the argument list for the probability functions.
|
| | 3 |
|
| | 4 | % Copyright 1993-2014 The MathWorks, Inc.
|
| | 5 |
|
| | 6 |
|
< 0.001 | 4 | 7 | errorcode = 0;
|
< 0.001 | 4 | 8 | varargout = varargin;
|
| | 9 |
|
< 0.001 | 4 | 10 | if nparms == 1
|
| | 11 | return;
|
| | 12 | end
|
| | 13 |
|
| | 14 | % Get size of each input, check for scalars, copy to output
|
< 0.001 | 4 | 15 | scalar = cellfun( @isscalar, varargin );
|
| | 16 |
|
| | 17 | % Done if all inputs are scalars. Otherwise fetch their common size.
|
< 0.001 | 4 | 18 | if (all(scalar)), return; end
|
| | 19 |
|
< 0.001 | 4 | 20 | n = nparms;
|
| | 21 |
|
< 0.001 | 4 | 22 | sz = cellfun( @size, varargin, 'UniformOutput', false );
|
< 0.001 | 4 | 23 | t = sz(~scalar);
|
< 0.001 | 4 | 24 | size1 = t{1};
|
| | 25 |
|
| | 26 | % Scalars receive this size. Other arrays must have the proper size.
|
< 0.001 | 4 | 27 | for j=1:n
|
< 0.001 | 12 | 28 | sizej = sz{j};
|
< 0.001 | 12 | 29 | if (scalar(j))
|
< 0.001 | 8 | 30 | vj = varargin{j};
|
< 0.001 | 8 | 31 | if isnumeric(vj)
|
< 0.001 | 8 | 32 | t = zeros(size1,'like',vj);
|
| | 33 | else
|
| | 34 | t = zeros(size1);
|
< 0.001 | 8 | 35 | end
|
< 0.001 | 8 | 36 | t(:) = vj;
|
< 0.001 | 8 | 37 | varargout{j} = t;
|
< 0.001 | 4 | 38 | elseif (~isequal(sizej,size1))
|
| | 39 | errorcode = 1;
|
| | 40 | return;
|
| | 41 | end
|
< 0.001 | 12 | 42 | end
|
Other subfunctions in this file are not included in this listing.