Main Content

Change Detector

Boolean signal change detector

  • Change Detector block

Simscape / Electrical / Control / General Control


The Change Detector block outputs a Boolean response of true when it detects a change in the Boolean input signal that meets one of these change criteria:

  • Rising edge — The input goes from false to true.

  • Falling edge — The input goes from true to false.

  • Either edge — The input goes from true to false or from false to true.



expand all

Input Boolean signal. If false, 0. If true, 1.

Data Types: Boolean


expand all

Output is true, 1, when the block detects a change that corresponds to the specified criteria (rising, falling, or either edge). Otherwise, output is false, 0.

Data Types: Boolean


expand all

Criteria for change detection.

Initial value of the previous input. If the input at the start of simulation is different from the initial condition value, the block detects an edge.

Time between consecutive block executions. During execution, the block produces outputs and, if appropriate, updates its internal state. For more information, see What Is Sample Time? and Specify Sample Time.

For inherited discrete-time operation, set this parameter to -1. For discrete-time operation, set this parameter to a positive integer. For continuous-time operation, set this parameter to 0.

If this block is in a masked subsystem or a variant subsystem that supports switching between continuous operation and discrete operation, promote this parameter to ensure correct switching between the continuous and discrete implementations of the block. For more information, see Promote Block Parameters on a Mask.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2018b