MATLAB Object-Oriented Programming

(Joyce) #1

methods
function obj = SupportmBGT(data)
if nargin > 0
obj.Prop = data;
end
end
function tf = isreal(obj)
tf = true;
end
function tf = gt(obj1, obj2)
tf = [obj1(:).Prop] > obj2.Prop;
end
end
end


Use mustBeGreaterThan with objects of this class:


a = SupportmBGT(10);
b = SupportmBGT(12);
mustBeGreaterThan(a,b)


Error using mustBeGreaterThan (line 19)
Value must be greater than the comparison value.


See Also


Related Examples



  • “Validate Property Values” on page 8-24

  • “Property Class and Size Validation” on page 8-31


See Also
Free download pdf