Define System Object Information
This example shows how to define information to display for a System object.Define System Object InfoYou can define your own info method to display specific information for your System
object. The default infoImpl method returns an empty struct. This infoImpl method
returns detailed information when info is called using info(x,'details') or only
count information if it is called using info(x).methods (Access = protected)
function s = infoImpl(obj,varargin)
if nargin>1 && strcmp('details',varargin(1))
s = struct('Name','Counter',
'Properties', struct('CurrentCount',obj.Count, ...
'Threshold',obj.Threshold));
else
s = struct('Count',obj.Count);
end
end
endComplete Class Definition File with InfoImplclassdef Counter < matlab.System
% Counter Count values above a thresholdproperties
Threshold = 1
endproperties (DiscreteState)
Count
endmethods (Access = protected)
function setupImpl(obj)
obj.Count = 0;
endfunction resetImpl(obj)
obj.Count = 0;
end34 System object Usage and Authoring