www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@data/DefineTestGroups.m

    function D = DefineTestGroups(D, variables, tolerances, testnumAlias, reorder)
%DEFINETESTGROUPS Allow definitions for the test groups with in the data.
%
%   D = DEFINETESTGROUPS(D, VARIABLES, TOLERANCES, TESTNUMBER_ALIAS, REORDER)
%   TESTNUMBER_ALIAS defaults to none and REORDER to false
% 
%   See also mbcmodel.data.DefineNumberOfRecordsPerTest.

%   Copyright 2004-2007 The MathWorks, Inc.

error(mbcnargchk(3, 5, nargin, 'mbc:mbcmodel:data'));

if nargin < 4
    testnumAlias = '';
end
if nargin < 5
    reorder = false;
end
% Convert a char variable input to a cell array
if ischar(variables)
    variables = {variables};
end
% Check that the variables are a cell array of char
if  ~(iscell(variables) && all(cellfun('isclass', variables, 'char')))
    error(message('mbc:mbcmodel:data:InvalidArgument2'));
end
% Check that the tolerances are the same length as the variables
if ~(isnumeric(tolerances) && isequal(numel(variables), numel(tolerances)))
    error(message('mbc:mbcmodel:data:InvalidArgument3'));
end
% Check that the reorder is a boolean of length 1
if ~(islogical(reorder) && numel(reorder) == 1)
    error(message('mbc:mbcmodel:data:InvalidArgument4'));
end
% Check that testnumAlias is a string
if ~ischar(testnumAlias)
    error('mbc:mbcmodel:data:InvalidArgument', ...
        'The testnumber alias must be a string');
end
% Make sure that the object is editable
D.pCheckIsBeingEdited;
try 
    D.Object = modifyTestDefinition(D.Object, {variables, tolerances, reorder, testnumAlias});
catch
    error(message('mbc:mbcmodel:data:UnknownError5'));    
end