www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregmodswitch/selectModels.m
function obj = selectModels(obj, idx) %SELECTMODELS Create new switch model based on a subset of contained models % % NEWOBJ = SELECTMODELS(OBJ, IDX) creates a new object, based on OBJ, that % contains only the valid switch points indexed by the index vector IDX. % IDX may be a double list of indices or a logical vector the same length % as the number of switch points. % Copyright 2000-2012 The MathWorks, Inc. and Ford Global Technologies, Inc. obj.OpPoints = obj.OpPoints(idx, :); ModelList = copy(obj.ModelList); ModelList.Models = ModelList.Models(idx); obj.ModelList = ModelList; if ~isempty(obj.constraints) obj.constraints = syncToModel(obj.constraints,obj,obj.OpPoints); end