www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgtabgradconstraint/checkInputSizes.m

    function [Status, Message] = checkInputSizes(obj, InSize)
%CHECKINPUTSIZES Check the compatibility of input lengths
%
%  [STATUS, MESSAGE] = CHECKINPUTSIZES(OBJ, INSIZE) checks that the
%  proposed lengths of the inputs, INSIZE, are acceptable and can produce a
%  valid set of outputs.  STATUS is a vector the same length as INSIZE that
%  contains integer codes indicating whether that input is acceptable.  A
%  status of 0 indicates no problem, 1 indicates a warning issue and 2
%  indicates an critical problem.  MESSAGE is a string that describes the
%  overall problem and should be non-empty whenever any inputs have a
%  non-zero status.

%   Copyright 2006 The MathWorks, Inc.

% Initialise return status - there's only one input.
Status = 0;

% Minimum input lengths depend on variable size.
NAXES = length(obj.pAxisVariables);

% All inputs must be of the same length
InSize = unique(InSize);

% Perform checks
if numel(InSize) > 1
    Status = 2;
    Message = 'Inputs must be of the same length';
elseif NAXES == 1 && InSize < 2
    % Flag an error if there is not enough points to fit the interpolant
    Status = 2;
    Message = 'Input must at least be of length 2';
elseif InSize < 1
    Status = 2;
    Message = 'Input must at least be of length 1';
else
    Message = '';
end