www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/+cgsimfill/@Table/RemoveVariables.m
function RemoveVariables(T,Cols) %RemoveVariables remove table values from fill % % RemoveVariables(T,Cols); % Copyright 2005-2011 The MathWorks, Inc. if any(Cols) % remove table values which can't be estimated T.Values= T.Values(~Cols); T.Indices= T.Indices(~Cols); T.JacobPattern= T.JacobPattern(:,~Cols); A= T.LinearConstraints{1}; C= T.LinearConstraints{2}; % delete zero table entries f=[]; for i= find(Cols) % find constraints which contain variable for cell i. f= [f; find(A(:,i))]; end f= unique(f); % delete cell variables A(:,Cols)=[]; % delete constraints A(f,:)= []; % delete bounds C(f,:)=[]; T.LinearConstraints= {A,C}; end