Reset Algorithm and Release Resources
Reset Algorithm State
When a user calls
reset on a System object, the internal
resetImpl method is called. In this example,
is an internal counter property of the
System object™. When a user calls
resets to 0.
classdef Counter < matlab.System % Counter System object that increments a counter properties (Access = private) pCount end methods (Access = protected) % Increment the counter and return % its value as an output function c = stepImpl(obj) obj.pCount = obj.pCount + 1; c = obj.pCount; end % Reset the counter to zero. function resetImpl(obj) obj.pCount = 0; end end end
Release System Object Resources
release is called on a System object, the
releaseImpl method is called if
setup was previously called (see Summary of Call Sequence).
This example shows how to implement the method that releases resources allocated and used by
the System object. These resources include allocated memory and files used for reading or
This method allows you to clear the axes on the Whiteboard figure window while keeping the figure open.
function releaseImpl(obj) cla(Whiteboard.getWhiteboard()); hold on end
For a complete definition of the
Whiteboard System object, see Create a Whiteboard System object.