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

    function [Status, Message] = checkSetup(obj)
%CHECKINPUTSIZES Check the object's parameters
%
%   [STATUS, MESSAGE] = CHECKSETUP(OBJ) checks that the object's settings
%   are acceptable.  STATUS is an integer code that indicates 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 the
%   status code is greater than 0.

%   Copyright 2006 The MathWorks, Inc.

[unused, lowerCode] = getLowerValueMode(obj);
[unused, upperCode] = getUpperValueMode(obj);
if isnull(getBoundedExpression(obj))
    Status = 2;
    Message = 'No expression has been selected to bound';
elseif lowerCode && isnull(getLowerExpression(obj))
    Status = 2;
    Message = 'No expression has been selected for the lower bound';
elseif upperCode && isnull(getUpperExpression(obj))
    Status = 2;
    Message = 'No expression has been selected for the upper bound';
elseif ~isComplete(obj)
    Status = 2;
    Message = 'The constraint settings are not valid';
elseif pIsScalarInfBound(obj, 'lower') || pIsScalarInfBound(obj, 'upper')
    Status = 1;
    Message = 'At least one of the bounds is infinite';
else
    Status = 0;
    Message = '';
end