I tried to make a model for you, where I tried to build a signal based on your description. Please click on the Signal Builder block and check it. Then, by using Detect Change block, I tried to capture the change in the input signal and with that each change, I reenabled a counter located in a Enabled Subsystem and it started counting again. Please run the simulation and open the Scope in the model. You will see that the counter is reset at every change and where it is reset, in the Scope, you will see that at values 4, 8, 12, 7 and 4, just as in the question, the counter is reset. Check the model and try to understand it and try to adapt it according to your purpose.
2 Comments
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/514880-change-detection-using-simulink#comment_820105
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/514880-change-detection-using-simulink#comment_820105
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/514880-change-detection-using-simulink#comment_820117
Direct link to this comment
https://de.mathworks.com/matlabcentral/answers/514880-change-detection-using-simulink#comment_820117
Sign in to comment.