Edge detection and counting of PWM Signal using matlab Package for Arduino


I am programming the arduino using Matlab with MATLAB Support Package for Arduino Hardware, I want to count the number of falling edges that comes from a flow sensor (PWM Signal 2.500 Pulses <–> 1 L), i need to know how to detect the edge and how use the Interrupt, so i can limit my interval and do the counting.

Have you please any solution?

The code depends on the library, for which you didn't provide a link.

For only 2500 pulses/L no interrupt is required, in detail if the Arduino has no other tasks to accomplish.