Main Content


Update object states based on inputs




updateImpl(obj,input1,input2,...) specifies the algorithm to update the System object™ states. You implement this method when your algorithm outputs depend only on the object’s internal state and internal properties.

Run-Time Details

updateImpl is called by the update method and after the outputImpl method.

For sink objects, calling updateImpl before outputImpl locks the object. For all other types of objects, calling updateImpl before outputImpl causes an error.

Method Authoring Tips

  • Do not use this method to update the outputs from the inputs.

  • You must set Access = protected for this method.

  • If the System object will be used in the Simulink® MATLAB System block, you cannot modify any tunable properties in this method.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your updateImpl method does not use the object, you can replace this input with ~.

List the inputs to the System object. The order of inputs must match the order of inputs defined in the stepImpl method.


expand all

Update the object with previous inputs. Use updateImpl in your class definition file. This example saves the u input and shifts the previous inputs.

methods (Access = protected)
   function updateImpl(obj,u)
      obj.PreviousInput = [u obj.PreviousInput(1:end-1)]; 

Version History

Introduced in R2013b