Main Content

hasChanged

Detect data change in test step

Description

hasChanged(u) returns true if the value of u changes since the beginning of the test step. Otherwise, hasChanged returns false.

Examples

Detect Value Change

Detect if x has changed value. This statement returns true if x has changed.

hasChanged(x)

Detect Value Change in a Bus

For a bus with two signals, signal_1 and signal_2, and data as the name of the input to the test sequence, detect when the value of signal_2 has changed.

hasChanged(data.signal2)

Tips

hasChanged statements can be used in the Test Sequence and Test Assessment blocks and in Stateflow® charts.

Introduced in R2015a