Dynamic-Calibration/utils/YALMIP-master/extras/@lmi/minus.m

23 lines
494 B
Mathematica
Raw Normal View History

2019-12-18 11:25:45 +00:00
function sys = minus(X,Y)
%MINUS (overloaded)
if isempty(X)
sys = ([]);
return
end
if isempty(Y)
sys = X;
return
end
if isa(Y,'double') || isa(X,'double')
error('You cannot substract a point from a set of constraint. Constraint substraction is only used removal of constraints. To translate a set, use REPLACE')
end
idX = getlmiid(X);
idY = getlmiid(Y);
YinX = find(~ismember(idX,idY));
% Get the correct subsref...
sys = subsref(X,struct('type','()','subs',{{YinX}}));