Matlab: Optical Shaft encoder

I tried to build a model in Simulink for my robot to tune the pid value. However, I didn’t find any way to collect data from Vex optical shaft encoder and covert the data to angular velocity in Simulink because I am totally new to Matlab. I use the algorithm that use change in encoder value divide by elapse in time to calculate angular velocity but I don’t really know how to do that in Matlab. If you could help me, I really appreciate it.

The latest release of the VEX Support Package (released in July 2016) contains specific encoders and Ultrasonic sensor blocks in the library. Please download the latest release and use the optical shaft encoder block directly.

Also, here is a demo with the integrated motor encoder block:
The demo discusses about the calculation of the distances and turn angles and how to include that in your Simulink model.

Hope that helps!