- Modify your MATLAB function to include a persistent counter that increments each time the function is called.
- The persistent keyword in MATLAB allows the variable callCount to retain its value between function calls.
- Also, the assignin function is used to save the desired value into base workspace.
- Use a MATLAB script to run the simulation and check the value of the counter after the simulation completes. For this purpose, you can use the evalin function:
- Once you have the count of function calls made in your base workspace, you can create a test sequence and assert if the call count matches the expected value.