time | Calls | line |
---|
| | 1 | function msg = surfchk(varargin)
|
| | 2 | %SURFCHK Check arguments to surf/mesh routines.
|
| | 3 | % MSG = SURFCHK(Z), or
|
| | 4 | % MSG = SURFCHK(Z,C), or
|
| | 5 | % MSG = SURFCHK(X,Y,Z), or
|
| | 6 | % MSG = SURFCHK(X,Y,Z,C) performs data validation on the inputs as if
|
| | 7 | % calling surf or mesh. An error message structure is returned if the
|
| | 8 | % inputs are invalid.
|
| | 9 |
|
| | 10 | % Copyright 2006-2016 The MathWorks, Inc.
|
| | 11 |
|
< 0.001 | 2 | 12 | narginchk(0,4);
|
| | 13 |
|
< 0.001 | 2 | 14 | msg.message = 0;
|
< 0.001 | 2 | 15 | msg.identifier = 0;
|
< 0.001 | 2 | 16 | msg = msg(zeros(0,1));
|
| | 17 |
|
< 0.001 | 2 | 18 | if nargin == 0
|
| | 19 | return;
|
< 0.001 | 2 | 20 | end
|
< 0.001 | 2 | 21 | if nargin == 2 || nargin == 4
|
| | 22 | zmatrix = varargin{nargin-1};
|
| | 23 | cmatrix = varargin{nargin};
|
< 0.001 | 2 | 24 | else
|
< 0.001 | 2 | 25 | zmatrix = varargin{nargin};
|
< 0.001 | 2 | 26 | cmatrix = zmatrix;
|
< 0.001 | 2 | 27 | end
|
| | 28 |
|
< 0.001 | 2 | 29 | if nargin == 1 || nargin == 2
|
| | 30 | [zm,zn] = size(zmatrix);
|
| | 31 | xmatrix = 1:zn;
|
| | 32 | ymatrix = 1:zm;
|
< 0.001 | 2 | 33 | else
|
< 0.001 | 2 | 34 | xmatrix = varargin{1};
|
< 0.001 | 2 | 35 | ymatrix = varargin{2};
|
< 0.001 | 2 | 36 | end
|
| | 37 |
|
0.001 | 2 | 38 | if (iscomplex(zmatrix) || iscomplex(cmatrix) || ...
|
| 2 | 39 | iscomplex(xmatrix) || iscomplex(ymatrix))
|
| | 40 | msg = struct('message',getString(message('MATLAB:hg:surface:CannotBeComplex')),...
|
| | 41 | 'identifier',id('ComplexData'));
|
< 0.001 | 2 | 42 | end
|
| | 43 |
|
< 0.001 | 2 | 44 | [xm,xn] = size(xmatrix);
|
< 0.001 | 2 | 45 | [ym,yn] = size(ymatrix);
|
< 0.001 | 2 | 46 | [zm,zn] = size(zmatrix);
|
| | 47 |
|
< 0.001 | 2 | 48 | if ((xm == 1 && xn ~= zn) || ...
|
| 2 | 49 | (xn == 1 && xm ~= zn) || ...
|
| 2 | 50 | (xm ~= 1 && xn ~= 1 && (xm ~= zm || xn ~= zn)) || ...
|
| 2 | 51 | (ym == 1 && yn ~= zm) || ...
|
| 2 | 52 | (yn == 1 && ym ~= zm) || ...
|
| 2 | 53 | (ym ~= 1 && yn ~= 1 && (ym ~= zm || yn ~= zn)))
|
| | 54 | msg = struct('message',getString(message('MATLAB:hg:surface:InvalidDataDimensions')),...
|
| | 55 | 'identifier',id('InvalidDataDimensions'));
|
< 0.001 | 2 | 56 | end
|
< 0.001 | 2 | 57 | if (zm == 1 || zn == 1)
|
| | 58 | msg = struct('message',getString(message('MATLAB:hg:surface:MustBeMatrix')),...
|
| | 59 | 'identifier',id('NonMatrixData'));
|
< 0.001 | 2 | 60 | end
|
Other subfunctions in this file are not included in this listing.