www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevtestplan/setupGroups.m
function [tssf,OK] = setupGroups(T,tssf,tol) %setupGroups setup groups for test plan data based on global inputs % Copyright 2014-2016 The MathWorks, Inc. and Ford Global Technologies, Inc. Inputs = getInputs(T); OK = true; isInUI = isBrowserProject(T); if numstages(T)>1 && isOneStage(tssf) if nargin<3 % default is data range/20 D = tssf(:,{Inputs{2}.Name}); Inputs{2} = DataRange(Inputs{2},D); tol = diff(cat(1,Inputs{2}.Range),[],2)/20; end % create test definition based on global variables testDef.variable = {Inputs{2}.Name}; testDef.tolerance = tol; testDef.reorder = false; testDef.testnumAlias = []; tssf = modifyTestDefinition(tssf,testDef); if isInUI % open dialog if in model browser % Get the current defineTests arguments args = struct2cell(get(tssf, 'defineTests')); % Get a base picture of the sweepset ss = sweepset(setAllows(tssf, {'DefineTest' 'testfilters' 'Reorder' 'Derived'},'off')); % Call the modal dialog with one-stage options disabled [OK, ~, testDefinition] = xregDefineTests('Create', get(MBrowser,'Figure'), ss, args,false); % Was OK pressed? if OK % Flush the event queue with the new data tssf = modifyTestDefinition(tssf, testDefinition); % check that data is two-stage OK = ~isOneStage(tssf); end end elseif numstages(T)==1 && ~isOneStage(tssf) % convert 2stage data to one-stage tssf = convertToOneStage( tssf ); end