matlab.System.getDiscreteStateImpl - Discrete state property values - MATLAB (original) (raw)
Main Content
Class: matlab.System
Discrete state property values
Syntax
s = getDiscreteStateImpl(obj)
Description
s = getDiscreteStateImpl(obj)
returns a struct s
of internal state value properties, which have the DiscreteState
attribute. The field names of the struct are the object’s DiscreteState
property names. To restrict or change the values returned bygetDiscreteState
method, you can override this getDiscreteStateImpl
method.
Method Authoring Tips
- You must set
Access = protected
for this method. - You cannot modify any properties in this method.
Input Arguments
System object handle used to access properties, states, and methods specific to the object. If your getDiscreteStateImpl
method does not use the object, you can replace this input with ~
.
Output Arguments
State values, returned as a struct.
Examples
Use the getDiscreteStateImpl
method in your class definition file to customize the behavior of getDiscreteState
method. The System object contains discrete states value
andpower
. A nontunable parameter keepTrack
determines the states displayed by getDiscreteState
method.
methods (Access = protected) function s = getDiscreteStateImpl(obj) if obj.keepTrack s.value = obj.value; s.power = obj.power; else s.value = obj.value; end end end
Version History
Introduced in R2012b